As Islam spread in Mecca, the ruling tribes began to oppose Muhammad's preaching and his condemnation of idolatry. ... In 622 CE, Muhammad and his followers migrated to Yathrib in the Hijra to escape persecution, renaming the city Medina in honor of the prophet.