Inscriptions found in the caves which honeycomb the base of the rock indicate that Sigiriya served as a place of religious retreat as far back as the century BC, when Buddhist monks established refuges here. It wasn’t until the fifth century AD, however, that Sigiriya rose briefly to pre-eminence in Sri Lankan affairs, following the power struggle which succeeded the reign of (Dhatusena (455-473) of Anuradhapura
Dhatusena had two sons, Mogallana by the most pre-eminent of his various queens, and Kassapa, his son by a lesser consort. Upon hearing that Mogallana had been declared heir to the thronge Kassapa rebelled, driving Mogallana into exile in India and imprisoning his father. The legend of Dhatusena’s subsequent demise offers an instructive illustration of the importance given to water in early Sinhalese civilization, Threatened with death if he refused to reveal the whereabouts of the stated treasure, Dhatusena agreed to show his errant son its location if he was permitted to bathe one final time in the great Kalawewa Tank, whose creation he had overseen. Standing in the tank, Dhatusena poured its water through his hands and told Kassapa that this alone was his treasure. Kassapa, none too impressed, had his father walled up in a chamber and left him to die.
Mogallana, meanwhile, vowed to return from India and reclaim his inheritance. Kassapa, preparing for the expected invasion, constructed a new residence on top of the 200-metre-high Sigiriya rock — a combination m pleasure palace and impregnable fortress, which Kassapa intended would emulate the legendary abode of Kubera, the god of wealth, while a new city was established around its base. According to tradition, the entire extraordinary structure was built in just seven years, from 477 to 485. The long-awaited invasion finally materialized in 491, Mogallana having raised an army of Tamil mercenaries to fight his cause. Despite the benefits at his impregnable fortress, Kassapa, in an act of fatalistic bravado, descended from his rocky eminence and rode boldly out on an elephant at the head of his troops to meet the attackers on the plains below. Unfortunately for Kassapa, his elephant took fright and bolted at the height of the battle. His troops, thinking he was retreating, fell back and left him cut off. Facing certain capture and defeat, Kassapa killed himself. Following Mogallana’s reconquest, Sigiriya was handed over to the Buddhist monks, after which its caves once again became home to religious ascetics seeking peace and solitude.The site was finally abandoned in 1155, after which it remained largely forgotten, excepting brief periods of military use by the Kingdom of Kandy in the sixteenth and seventeenth centuries, until being rediscovered by the British in 1828.