After Kartikeya, son of Lord Shiva and Goddess Parvati killed the demon king Taraka, his kingdom fell apart. His sons, Tarakaksha, Vidyunmali and Kamalaksha, began to perform severe penances to appease Lord Brahma. After a few years, a pleased Lord Brahma approached them and said, “Your devotion pleases me immensely. Ask me for any boon you want.”
The demons asked him to aid them in building three indestructible cities for them. Lord Brahma replied, “Nothing in this world stays forever. However, the three cities will be safe and strong, and will only be destroyed with one arrow.”
The chief architect of the demons, Maya, planned and built the cities. Three floating cities were built - the one on earth was made of iron, the one in the sky was made of gold. The three cities were collectively called Tripura.
The three cities would float apart from each other, but once in every thousand years, they would align in a single line with the Pushya star and the moon. This phenomenon would last for only a split second.
After some time, the demons were not content with living peacefully and decided to lay siege all over the Universe. Maya sensing the impending doom, started to perform penance to appease the gods. The gods sought Lord Shiva’s help in turn. Lord Shiva assured them that he would reduce the three cities to ashes if the demons refused to stop their villainous ways.
Assured that Lord Shiva will fight the demons, the gods attacked the demons with more vigour. So fierce was the fight that the earth slipped from its position and began falling. Lord Vishnu turned into a bull to push back the earth and hold it in its rightful place.
The demons grew very concerned on the day when Lord Shiva was supposed to enter the battlefield. They made several plans to keep him diverted. They knew that if anyone can destroy their cities, it will be Lord Shiva. Lord Shiva finally arrived on the battleground, raised his bow and arrow to strike the cities. The arrow split the three cities in one go, as it was the moment of alignment, reducing Maya’s splendid cities to dust and ashes. The demons too perished along with their magnificent cities, finally restoring peace in the Universe.