Earlier is was a rock-shelter mountain monastery which was donated by Buddhist devotees. Later King Kassapa renovated it by building gardens and palace. After his death it was again used as a monastery.Human habilitation in Sigiriya at its earliest was found to be nearly five thousand years during the Mesothilic period. Rock inscriptions are carved near the drip ledges on many of the shelters, recording the donation of the shelters to the Buddhist monastic order as residences. These have been made within the period between the third century B.C and the first century A.D.In 1831 Major Jonathan Forbes of the 78th Highlanders of the British army while returning on horseback from a trip to Polonnaruwa came across the "bush covered summit of Sigiriya". Sigiriya came to the attention of antiquarians and later archaeologists.The Sigiriya complex itself consists of the central rock and two rectangular precincts which are surrounded by two moats and three ramparts. The city is based on a square module.