Foreign invaders often used abandoned viharas and temples as military cantonments. They set up their headquarters in Nalanda region and called it Bihar, which is derived from the term Vihar. The region roughly encompassing the present state of Bihar was dotted with Buddhist vihara, which were the abodes of Buddhist monks in the ancient and medieval period. The town still exists and is called Bihar or Bihar Sharif (Nalanda District). Later on, the headquarters was shifted from Bihar to Patana (current Patna) by Sher Shah Suri and the whole Magadha region was called Bihar.