Yapahuwa was a well secured rock fortress which became the 4th kingdom of Sri-Lanka during the 14th century A.D. and which is home to beautiful rock sculptures unsurpassed in any other nation. The palace and fortress were built by King Buvanekabahu I (1272–1284) in the year 1273. Many traces of ancient battle defences can still be seen, while an ornamental stairway, is its biggest showpiece. On top of the rock are the remains of a stupa, a Bodhi tree enclosure, and a rock shelter/cave used by Buddhist monks, indicating that earlier this site was used as a Buddhist monastery, like many boulders and hills in the area. There are several caves at the base of the rock. In one of them there is a shrine with Buddha images. One cave has a Brahmi script inscription. At the southern base of the rock there is a fortification with two moats and ramparts. In this enclosure there are the remains of a number of buildings including a Buddhist shrine. There is also a Buddhist temple called Yapahuwa Rajamaha Vihara built during the Kandyan period.