 In 1299, Alauddin Khalji's army under the leadership of Ulugh Khan defeated Karandev II of the Vaghela dynasty, and sacked the Somnath temple.The temple was rebuilt by Mahipala Deva, the Chudasama king of Saurashtra in 1308.It was repeatedly attacked in the later centuries, including by the Mughal emperor Aurangzeb.