The earlier history of Garhwal region finds its mention in the Indian epics of Ramayana and Mahabharata and has been a favorite locale for the mythology of the Puranic period. It was earlier known as Kedarkhand, a region of Kedarnath and a number of tribes inhabited there including the Sakas, nagas, Khasas, Kiratas and Hunas. The first known king that ruled in the region was Bhanupratap and later his son-in-law Kanakpal over took him. In the 15th century, King Ajaypal merged the 52 separate principalities with its own garh or fortress and Garhwal remained as one kingdom for the next 300 years. The Gorkhas of Nepal invaded the region in 1803 along with Srinagar. In 1815, the British dragged out the Gorkhas and established their stronghold in the region. In 1947 when India got Independence, the British Garhwal became a part of the Indian Union.