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.