Muhammad had preached the religion of Islam in Mecca from 613 to 622. He had attracted a small community of followers, but also had opposition from the rest of the Quraysh, the clan that ruled Mecca and to which he belonged. The Muslims fled Mecca in 622 after years of persecution and established themselves at Medina (formerly known as "Yathrib"). They considered themselves to be in a state of war with Mecca and raided Meccan caravans that had Muslim belongings left in Mecca. The Meccans sent out a small army to punish the Muslims and stop their raiding. At the Battle of Badr in 624, a small Muslim force had defeated the much larger Meccan army. 