Environment around the Sigiriya may have been inhabited since prehistoric times. There is clear evidence that the many rock shelters and caves in the vicinity were occupied by Buddhist monks and ascetics from as early as the 3rd century BCE.
In 477 CE, kasyapa, the king’s son by a non-royal consort, seized the throne from King Dathusena, following a coup assisted by Migara, the king’s nephew and army commander. The rightful heir, Mugalan, fearing for his life fled to South India. Fearing an attack from Mugalan, Kashyapa moved the capital and his residence from the traditional capital of Anuradhapura to the more secure Sigiriya. During King Kashyapa’s reign (477 to 495 CE), Sigiriya was developed into a complex city and fortress. Most of the elaborate constructions on the rock summit and around it, including defensive structures, palaces, and gardens, date from this period.