Tripura (Tamil: Tiripuram, Thai: Triburam) meaning three cities, was constructed by the great Asura architect Mayasura. They were great cities of prosperity, power and dominance over the world, but due to their impious nature, Maya's cities were destroyed by god Tripurantaka, an aspect of Shiva. The three cities were made of iron, silver and gold and were located on earth, in the sky and in heaven, respectively.
Penances of the sons of Taraka
Following the death of Tarakasura, who was killed by Kartikeya, his sons Tarakaksha, Vidyunmali and Viryavana undertook severe penances by which they pleased Lord Brahma. They requested that they may become immortal, resisting it, Brahma said to them that nothing can be immortal. Then Tarkaksh and viryavana asked to be blessed with impregnable fortresses, which would be everlasting. However, as Brahma told them that nothing could be everlasting, they requested that the destruction of the cities could be brought about by a single arrow only, on the hope that it was impossible for anyone to shoot such an arrow, save Lord Shiva, of whom they were great devotees. Brahma then blessed them that such fortresses would be constructed by the architect.
The construction of the three cities
The three cities which comprised Tripura were distributed thus:
The three cities were mobile and moved in such a way that they would never be in a single line, save for a few moments in around a thousand years, when the nakshatra Pushya would be in conjunction with the moon. They were thus reassured that they were quite safe, as it would be an extremely difficult task to destroy the three cities, which aligned only momentarily, by a single arrow.
Asuras from everywhere began to flock to Tripura to live. The cities were extremely luxurious and prosperous.
Forebodings of the fall of Tripura
After several years of joy, the inherent evil tendencies of the Asuras surfaced once again and they began to oppress the good and torment the noble. In the meantime, Mayasura was engaged in the worship of Shiva. The rest of the demons attacked sages and the Devas and shattered the peace of the worlds. Finally, when Indra and the rest of the Devas despondently approached Lord Brahma for respite, Lord Brahma redirected them to Shiva and also informed them of the vulnerability of Tripura to a single arrow. Lord Shiva promised to help them and the Devas returned to combat the Asuras in a mighty war. They were also assisted by Nandi, the leader of Lord Shiva's Ganas. Even though Vidyunmali was slain by Nandi, and several other Asuras were killed in the war, they were revived by water in the pool of Tripura, which had magical powers.
Vishnu descends to help
As the furious war continued between the Asuras and the Devas, even the Earth began to slip from its place. Just as Brahma and Shiva were worrying about the Earth's descent, the Protector god Vishnu, in the form of a massive boar, lifted the earth and restored it to its original place. He then entered Tripura and drank dry, the pool of magic water that rejuvenated the dead Asuras.
The destruction of Tripura
As the war raged on, Devas continued to struggle to match the Asuras, who used their magical powers to great effect in the war. One day the three cities aligned. Shiva ordered that a chariot be made from which he would battle the three demons.
The war-chariot designed for Shiva was different. The Earth or Prithvi became the chariot with the Sun and Moon its wheels. Brahma was holding the reins. Mount Meru became the bow and the serpent Vasuki was the bow string. Vishnu was the arrow, and Agni was the tip of the arrow. Vayu was inside the feathers on rear of the arrow. All other Devas had their own places and forms in the chariot. Just as the cities aligned, when the Pushya nakshatra positioned appropriately, Lord Shiva was about to strung the mighty bow, the Pinaka with the arrow, the Devas were overjoyed that Tripura was going to be destroyed because of them (because they were part of the war-chariot, without which Shiva cannot destroy).
Lord Shiva, knowing what the Devas were thinking, did not fire the arrow and just smiled. All the three purams were burned immediately. Shocked at this act, Brahma pleaded that Devas thought wrong and that Shiva should forgive and release the arrow, or else the Devas would have a permanent bad name and the reason behind making this chariot would become meaningless. Shiva then fired the arrow on the already burning Cities.
When Lord shiva seated on the chariot before heading to war,chariot was unable to move forward,lord Vishnu took form as bull and dragged the chariot and then became the bull flag on top of chariot.After destroying three cities lord shiva started tandava nritya on debris which is also called as "Tripura Nasha Nartana".
The Devas then understood:
1. Shiva can take the power of anyone/anything because it is his power that is already existing in first place.
2. Even though the boon granted was "one-arrow-one-shot and cities should be destroyed", Shiva has the ultimate power to rule them over.
3. Lord Shiva does not require a huge Chariot with Meru as bow, Vishnu as arrow etc. He could simply destroy/create anything even without moving his eyes.
The "smile and burn" act of Shiva in Tamil is beautifully called as "punnagaithu purameritha peruman" (God who laughed and burned the three purams)
Lord Shiva immediately regretted his act, since he had forgotten to protect Maya, a great devotee of his. Realising this, Nandi raced ahead of the arrow and informed Maya of the impending doom. Instantly, Maya fled Tripura, leaving behind the great city he had constructed, which was immediately reduced to ashes, along with its inhabitants, the Asuras, by the great arrow of Shiva. This destruction of Tripura, led to the appellation Tripurantaka (त्रिपुरान्तक), for Shiva.