Yapahuwa was the ancient capital for a very short time in fact only 12 years.This was an extremely turbulent time for the Sinhalese kingdom was falling because of a mixture intrigue, a betrayal and invasions from the south of India. Recognizing the defensive potential of Yapahuva, the King Buvenekabahu I decided to build the capital there. He built a fortress with a double line of defensive walls separated by a moat.