The Constitution of Medina
Upon his arrival in Medina, Muhammad unified the tribes by drafting the Constitution of Medina, which was a formal agreement between Muhammad and all of the significant tribes and families of Medina, including Muslims, Jews, Christians, and pagans. This constitution instituted rights and responsibilities and united the different Medina communities into the first Islamic state, the Ummah.
An important feature of the Constitution of Medina is the redefinition of ties between Muslims. It set faith relationships above blood ties and emphasized individual responsibility. Tribal identities were still important, and were used to refer to different groups, but the constitution declared that the "main binding tie" for the newly created Ummah was religion. This contrasts with the norms of pre-Islamic Arabia, which was a thoroughly tribal society. This was an important event in the development of the small group of Muslims in Medina to the larger Muslim community and empire. While praying in the Masjid al-Qiblatain in Medina in 624 CE, Muhammad received revelations that he should be facing Mecca rather than Jerusalem during prayer. Muhammad adjusted to the new direction, and his companions praying with him followed his lead, beginning the tradition of facing Mecca during prayer.
The Masjid al-Qiblatain, where Muhammad established the new Qibla, or direction of prayer
Muhammad received revelations that he should face Mecca, rather than Jerusalem, in 624 CE.
Beginning of Armed Conflict
Economically uprooted by their Meccan persecutors and with no available profession, the Muslim migrants turned to raiding Meccan caravans. This response to persecution and effort to provide sustenance for Muslim families initiated armed conflict between the Muslims and the pagan Quraysh of Mecca. Muhammad delivered Quranic verses permitting the Muslims, "those who have been expelled from their homes," to fight the Meccans in opposition to persecution. The caravan attacks provoked and pressured Mecca by interfering with trade, and allowed the Muslims to acquire wealth, power, and prestige while working toward their ultimate goal of inducing Mecca's submission to the new faith.
Battle of Badr
In March 624, Muhammad led three hundred warriors in a raid on a Meccan merchant caravan. The Muslims set an ambush for the caravan at Badr, but a Meccan force intervened and the Battle of Badr commenced. Although outnumbered more than three to one, the Muslims won the battle, killing at least forty-five Meccans. Muhammad and his followers saw the victory as confirmation of their faith, and Muhammad said the victory was assisted by an invisible host of angels. The victory strengthened Muhammad's position in Medina and dispelled earlier doubts among his followers.
Battle of Uhud
To maintain economic prosperity, the Meccans needed to restore their prestige after their defeat at Badr. Abu Sufyan, the leader of the ruling Quraysh tribe, gathered an army of 3,000 men and set out for an attack on Medina. Muhammad led his Muslim force to the Meccans to fight the Battle of Uhud on March 23, 625 CE. When the battle seemed close to a decisive Muslim victory, the Muslim archers left their assigned posts to raid the Meccan camp. Meccan war veteran Khalid ibn al-Walid led a surprise attack, which killed many Muslims and injured Muhammad. The Muslims withdrew up the slopes of Uḥud. The Meccans did not pursue the Muslims further, but marched back to Mecca declaring victory.
For the Muslims, the battle was a significant setback. According to the Quran, the loss at Uhud was partly a punishment and partly a test for steadfastness.
Conquest of Mecca and Arabia
After eight years of fighting with the Meccan tribes, Muhammad gathered an army of 10,000 Muslim converts and marched on the city of Mecca. The attack went largely uncontested and Muhammad took over the city with little bloodshed. Most Meccans converted to Islam. Muhammad declared an amnesty for past offenses, except for ten men and women who had mocked and made fun of him in songs and verses. Some of these people were later pardoned. Muhammad destroyed the pagan idols in the Kaaba and then sent his followers out to destroy all of the remaining pagan temples in Eastern Arabia.
Following the conquest of Mecca, Muhammad was alarmed by a military threat from the confederate tribes of Hawazin, who were raising an army twice the size of Muhammad's. The Banu Hawazin were old enemies of the Meccans. They were joined by the Banu Thaqif, who adopted an anti-Meccan policy due to the decline of the prestige of Meccans. Muhammad defeated the Hawazin and Thaqif tribes in the Battle of Hunayn.
At the end of the 10th year after the migration to Medina, Muhammad performed his first truly Islamic pilgrimage, thereby teaching his followers the rules governing the various ceremonies of the annual Great Pilgrimage. In 632, a few months after returning to Medina from the Farewell Pilgrimage, Muhammad fell ill and died. By the time Muhammad died, most of the Arabian Peninsula had converted to Islam, and he had united Arabia into a single Muslim religious polity.