 Muhammad's task would thus be to form a united community out of these heterogeneous elements, not only as a religious preacher, but as a political and diplomatic leader who could help resolve the ongoing disputes.By 622, Muhammad had migrated to Medina with a group of his followers, having escaped the forces of Quraysh.They were given shelter by members of the indigenous community known as the Ansar.