al-Masʿudi recorded that Caliph al-Mahdi (r. 775–785 CE) rebuilt Jerusalem after it had been devastated by earthquakes.