An oasis town in western Saudi Arabia, 447 km (278 miles) from Mecca, known as Yathrib before Muhammad's residence there. Medina is second only to Mecca as the holiest place of Muslim pilgrimage. It is venerated by all Muslims as the place to which the Prophet Muhammad fled from Mecca in 622. This event (the Hijrah / Hegira / higira) marks the beginning of the Islamic era and Muslim calendar. Muhammad built himself a house consisting of a walled compound containing a courtyard, living quarters, and a double portico. The Prophet and his followers worshipped here and the building, with its large courtyard and covered hall, became the prototype of congregational mosques, such as those at Samar-Ra. Soon afterward Muhammad drove out the Jews who had controlled the oasis. Thereafter known as Medina, the city prospered as the administrative capital of the steadily expanding Islamic state, a position it maintained until 661, when it was superseded in that role by Damascus. The House of the Prophet was rebuilt in 707-709 by the caliph al-Walid, who inserted a niche (the mihab) in the end wall of the portico to indicate the direction one must face while praying.