Nalanda was one of the first residential universities, i.e. it had dorms. During its days it was a flourishing residential university with over 10,000 students and 1500 teachers. The university was marked by a lofty wall and one gate. The library was located in a nine storied building. The subjects taught at Nalanda University covered every field of learning. The Tang Dynasty Chinese pilgrim Xuanzang left detailed accounts of the university in the 7th century.
A vast amount of what is considered to be Tibetan Buddhism (Vajrayana) actually stems from the late (9th-12th century) Nalanda teachers and traditions. Other forms of Buddhism, like the Mahayana followed in Vietnam, China, Korea and Japan, found their genesis within the walls of the ancient university. Theravada, the other main school of Buddhism, followed in Sri Lanka, Myanmar, Thailand, Cambodia, and elsewhere, and later the mystic Theravada schools also developed here.
In 1193, the Nalanda University complex was sacked by Turkic Muslim invaders under Bakhtiyar Khalji; this event is seen as a milestone in the decline of Buddhism in India. It is said that Khalji asked if there was a copy of the Koran at Nalanda before he sacked it. When the Tibetan translator Chag Lotsawa visited them in 1235, he found them damaged and looted, but still functioning with a small number of monks.