Nalanda is about 90 km southeast of Patna. Although its history goes back to the times of the Buddha, the university at Nalanda was founded in the 5th century CE, and it flourished for the next 700 years. Its decline began in the late Pala period, but the final blow was the invasion by Bakhtiyar Khilji around 1200 CE. The subjects that were taught at Nalanda included Buddhist scriptures (of both the Mahayana and Hinayana schools), philosophy, theology, metaphysics, logic, grammar, astronomy and medicine. Chinese travellers Hiuen-Tsang and I-Tsing had written detailed accounts about the university.