Dharmarajan, who was cursed, sought to free himself from this curse. To do so, he performed penance at Alagar, the location of the current temple, on a mountain known as Virushupagiri, which consists of seven hills. Pleased with Dharmarajan's penance, Lord Perumal appeared before him. In gratitude for the Lord's compassion, Dharmarajan requested the boon to conduct a daily puja at the temple. It is believed that Dharmarajan himself performs the Artha Jama Puja (a late-night ritual) every day in the temple to receive the blessings of Perumal. The Somasanda Vimana (circular sanctum) was constructed by Vishwakarma at Dharmarajan's request, to bless all devotees who visit the temple.
Sthala Puranam :
Madurai, known for its rich cultural heritage and stunning architecture, is a city blessed with divine beauty. It is home to the captivating fish-eyed Meenakshi, the handsome Sundareswarar, the radiant Vishnu as Kallazhagar, and Koodal Azhagar, as well as the ever-youthful Murugan at Alagar Malai.
The temple, popularly known as the Kallazhagar Temple, enshrines the deity Sundararaja Perumal. The legend associated with this temple dates back to the time of King Malayadhwajan, whose daughter Meenakshi married Shiva. As Parvati’s brother, Vishnu had to descend to earth to give her away in marriage. However, when Vishnu left His abode at Alagar Kovil to attend the wedding, he was delayed. By the time he reached the Vaigai River, he received the news that the wedding had already taken place. In his fury, Vishnu decided to turn back. However, Sundareswarar and Meenakshi came to the Vaigai River to pacify him. He then bestowed the gifts he had brought upon them at a mandapam in the middle of the Vaigai River.
At a time when there was no death on earth due to the righteous lives led by people, a man once tried to harm a woman. Yama, the god of death, immediately punished him. Realising the need for rules and a ruler to enforce them, Shiva appointed Yama for the task and gave him fangs to instil fear. Disappointed with his appearance, Yama worshipped Lord Vishnu at this temple, seeking a handsome face. Vishnu appeared before him and blessed him. Yama’s only other request was that Vishnu stay at the temple forever and that he (Yama) be allowed to worship him at least once a day. This is believed to be the reason why Vishnu, as Sundararaja Perumal, resides at Azhagar hills. It is also believed that Yama himself performs the ardha jama puja (the last puja of the day) at the temple.
Another legend involves Sage Sutapa, who was bathing in the Noopura Ganga and failed to pay respects to Sage Durvasa when he passed by. As a result, Durvasa cursed Sutapa, turning him into a frog, henceforth known as Manduka Rishi. The sage prayed to Vishnu, who came from the foothills of Azhagar hills to Noopura Gangai to relieve him of the curse.
The Noopura Gangai is the temple’s sacred theertham (holy water), with Rakayee Amman as its presiding deity. Rakayee Amman, the sister of Kallazhagar Perumal, has a separate shrine below which the Noopura Gangai flows. It is believed that Adiseshan guards Perumal during the day, while Rakayee Amman guards him at night.
At the temple’s eastern entrance, there are 18 steps, each with its own legend. Once, 18 men attempted to rob the temple and steal the murti of Kallazhagar. However, upon seeing the deity, they were so captivated by his beauty that they prayed to him, asking not to leave his presence. It is believed that these men were transformed into the 18 steps.
The Kallazhagar Temple is primarily a Pandya period construction, mainly attributed to Jatavarman Sundarapandian, although the Nayaks of Madurai, particularly Tirumalai Nayakar, and the Vijayanagara Dynasty, especially Krishnadeva Raya, have also made significant contributions.
In the late 13th and early 14th centuries, during the siege of Madurai by Islamic forces led by Malik Kafur, the idol of Ranganathar from Srirangam was hidden in various places, including this temple, before eventually being returned to Srirangam.
The temple is mentioned in various literary works, including the Divya Prabhandam of the Azhvars, other religious and spiritual texts, and the Sangam epic Silappatikaram.
The temple premises are constructed like a fort, with temple lands extending beyond the walled enclosures. Local farmers offer their first yield of crops to the temple, which are processed, ground, and made into a batter to prepare the famous Azhagar Koil dosai prasadam.
There is also an unfinished gopuram (gateway tower) at the side of the Perumal temple, at the beginning of the road leading to the Murugan temple above. This gopuram was intended for the Perumal temple, and construction was initiated by Krishna Deva Raya. However, it was left unfinished following his defeat.