The Prophet Muhammad left the city of Mecca because he wanted to spread his teachings to the people of Medina. Many other factors contributed to the pilgrimage, including persecution and discrimination by the people of Mecca, while the inhabitants of Medina were very welcoming towards the Prophet, his followers and the religion of Islam.
Muhammad left Mecca to escape persecution and to spread Islam after being invited by the people of Medina in 622 CE. His migration, known as the Hijra, marked a pivotal moment for the early Muslim community, allowing them to establish a supportive environment. This event is also recognized as the starting point of the Islamic calendar.
;