Considered to be the highest of the Vedic Pantheon, Varuna was worshipped as the Supreme Lord of the Cosmos. He was also the the keeper of divine order, the bringer of rain, and the enforcer of contracts. But he was also feared as the God of the Dead and it was believed that he would kill those who broke their promises.
Later Indra supplanted him as King of the Gods. This is likely because of the story that tells of how the demon Vitra stole the celestial waters, which falls through the holes of the sky as rain, from Iruna, which he had charge of. It was Indra who fought the demon and got the waters back.
After this he was stripped of his Lordship over the Heavens and given Lordship over the Waters of the Earth. Which is where he has remained as one of the Guardians of the Directions.