Madina's Jewish tribes were not eager to honor their agreements with The Messenger after his Emigration. During the Battle of Badr, they favored the Makkan polytheists; afterwards, they openly encouraged the Quraysh and other Arab tribes to unite against the Muslims. They also collaborated with the Hypocrites, who were apparently an integral part of the Muslim body politic. To sabotage the spread of Islam, they began to fan the flames of old animosities between the Aws and Khazraj, the two tribes of Madinan Muslims. Ka'b ibn Ashraf, chief of Banu Nadir, went to Makka and recited stirring elegies for the Makkans killed at Badr to provoke the Quraysh into renewed hostilities. He also slandered the Muslims and satirized The Messenger in his poems.
The Jewish tribes' violation of their treaty obligations exceeded all reasonable limits. A few months after Badr, a Muslim woman was treated indecently by some Jews of Banu Qaynuqa, the most anti-Muslim Jewish tribe. During the ensuing fight, a Muslim was martyred and a Jew was killed. When The Messenger reproached them for this shameful conduct and reminded them of their treaty obligations, the Jews threatened him: "Don't be misled by your encounter with a people who have no knowledge of warfare. You were lucky. By God, if we fight you, you will know that we are the men of war."
Finally, The Messenger attacked the Banu Qaynuqa, defeated them, and banished them from Madina's outskirts. In addition, upon the order of The Messenger, Muhammed ibn Maslama killed Ka'b ibn Ashraf and ended his trouble-making activities. 
The reasons for the battle. The Quraysh were still smarting from their defeat at Badr. Their women were mourning their dead warriors almost daily, and encouraged the survivors to revenge themselves. In addition, the Jewish efforts to rouse their feelings of revenge were like pouring oil on flames. Within a year (625 CE), the Quraysh attacked Madina with an army of 3,000 soldiers, including 700 in coats of mail and 200 cavalrymen.
Informed of the Makkans' march upon Madina, The Messenger consulted with his Companions about how to meet this threat. He had dreamed that he was in his coat of mail with his sword notched, and that some oxen were being slaughtered. He interpreted this to mean that they should defend themselves within Madina's boundaries, and that a leading member of his kinsmen, together with some Companions, would be martyred.  He also knew that the Makkan army was coming to fight on open ground. Thus, if the Muslims defended themselves within Madina, the Makkan army could not mount a long siege. He stressed once more that Muslims represent peace and security, and that they should resort to force only to eliminate an obstacle to the preaching of Islam or to defend themselves, their faith, or their country.
However, several young people longed for martyrdom. Upset that they had not fought at Badr, they wanted to fight the enemy outside of Madina. The Messenger gave in to this ultimately majority demand. When these young people repented, upon warning from their elders about their insistence, and the elders informed The Messenger of this, the Messenger replied: "It does not befit a Prophet to take off his coat of mail once he has put it on." 
Having decided to follow the majority, The Messenger and 1,000 warriors left Madina for Uhud, a volcanic hill only a few miles from its western outskirts. Its main feature was a plain that stretched out before it. When they were only half way there, however, 'Abd Allah ibn Ubayy ibn Salul turned back with his 300 men. This event, coming just before the battle began, caused such perplexity and confusion that the Banu Salama and Banu Haritha tribes also wanted to turn back. Eventually, they were persuaded to remain.
The Messenger advanced with the remaining ill-equipped 700 Muslims. He lined them up at the foot of Mount Uhud so that the mountain was behind them and the Qurayshi army in front of them. The enemy could launch a surprise attack from only one mountain pass. The Messenger posted 50 archers there under the command of 'Abd Allah ibn Jubayr. He told him not to let anyone approach or move from that spot, adding: "Even if you see birds fly off with our flesh, don't move from this place." 
The standard bearer was Mus'ab ibn 'Umayr. Zubayr ibn 'Awwam commanded the cavalry, and Hamza commanded the infantry. The army was ready to fight. To encourage his Companions, the Prophet brought forth a sword and asked: "Who would like to have this sword in return for giving its due?" Abu Dujana asked: "What is its due?" "To fight with it until it is broken," the Prophet answered. Abu Dujana took it and fought.  Sa'd ibn Abi Waqqas and 'Abd Allah ibn Jahsh prayed to God to make them encounter the strongest enemy soldiers. Hamza, the Prophet's uncle and "Lion of God," wore an ostrich feather on his chest. The verse revealed to describe the godly persons around previous Prophets pointed also to them:
Many a Prophet there was, with whom a large number of God-devoted men fought. They fainted not for anything that befell them in the way of God, neither weakened nor abased themselves. God loves the steadfast. Nothing else did they say but: "Our Master, forgive our sins, and that we exceeded in our affair. Make our feet firm, and help us against the unbelievers." God gave them the reward of the world and the good reward of the Hereafter. God loves those who do good. (3:146–48)
In the first stage, the Muslims defeated the enemy so easily that Abu Dujana, with the sword the Prophet had given him, pushed into the center of the Qurayshi army. There he met Abu Sufyan's (the Qurayshi commander) wife Hind. He tried to kill her but, "in order not to dirty the sword given by the Prophet with a woman's blood," spared her. 'Ali killed Talha ibn 'Abi Talha, the enemy's standard-bearer. All who carried the Qurayshi standard were killed by 'Ali, 'Asim ibn Thabit, or Zubayr ibn 'Awwam. After that, such self-sacrificing heroes of the Muslim army as Hamza, 'Ali, Abu Dujana, Zubayr, and Miqdad ibn 'Amr flung themselves upon the enemy and routed them.
When the enemy began to flee, the Muslims gathered the spoils. The archers on the mountain pass saw this and said to themselves: "God has defeated the enemy, and our brothers are collecting the spoils. Let's join them." 'Abd Allah ibn Jubayr reminded them of the Prophet's order, but they said: "He ordered us to do that without knowing the outcome of the battle." All but a few left their posts and began to collect booty. Khalid ibn Walid, still an unbeliever and commander of the Qurayshi cavalry, seized this opportunity to lead his men around Mount Uhud and attacked the Muslims' flank through the pass. 'Abd Allah ibn Jubayr's depleted forces could not repel them.
The fleeing enemy soldiers came back and joined the attack from the front. Now, the battle turned against the Muslims. Both of these sudden attacks by superior forces caused great confusion among the Muslims. The enemy wanted to seize The Messenger alive or kill him, and so attacked him from all sides with swords, spears, arrows, and stones. Those who defended him fought heroically.
Hind, having lost her father and brothers at Badr, urged Wahshi, a black slave, to kill Hamza. When the scales turned, Hamza fought like a furious lion. He had killed almost 30 people when Wahshi's lance pierced him just above the thigh. Hind came forward and ordered Hamza's stomach split open. She then mutilated his body and chewed his liver.
 Ibid. 3:664–7.
 Bukhari, "I'tisam," 28; Ibn Hisham, Sira, 3:68.
 Bukhari, "Jihad," 164; Abu Dawud, "Jihad," 6.
 Muslim, "Fada'il al-Sahaba," 128; Ibn Hanbal, 3:123.
Ibn Kami'a martyred Mus'ab ibn 'Umayr, the Muslims' standard-bearer who had been fighting in front of him. Mus'ab resembled The Messenger in build and complexion, and this caused Ibn Kami'a to announce that he had killed The Messenger. Meanwhile, the Messenger had been wounded by a sword and some stones. Falling into a pit and bleeding profusely, he stretched his hands and prayed: "O God, forgive my people, because they do not know (the truth)." 
The rumor of the Prophet's martyrdom led many Companions to lose courage. In addition to those like 'Ali, Abu Dujana, Sahl ibn Hunayf, Talha ibn 'Ubaydullah, Anas ibn Nadr, and 'Abd Allah ibn Jahsh, who fought self-sacrificingly, some Muslim women heard the rumor and rushed to the battlefield. Sumayra, of the Badu Dinar tribe, had lost her husband, father, and brother. All she asked about was The Messenger. When she saw him, she said: "All misfortunes mean nothing to me as long as you are alive, O The Messenger!"  Umm 'Umara fought before the Messenger so heroically that he asked her: "Who else can endure all that you endure?" That pride of womanhood took this opportunity to ask him to pray for her: "O Messenger of God, pray to God that I may be in your company in Paradise!" The Messenger did so, and she responded: "Whatever happens to me from now on doesn't matter." 
Anas ibn Nadr heard that The Messenger had been martyred. He fought so valiantly that he suffered 80 wounds.  They found Sa'd ibn Rabi' dying with 70 wounds on his body. His last words were: "Convey my greetings to The Messenger. I sense the fragrance of Paradise from behind Uhud."
Besides Abu Dujana and Sahl ibn Hunayf, 'Ali stood in front of The Messenger and defended him. Three times the Messenger pointed to some of the enemy who were advancing toward them; each time 'Ali attacked and routed them.
Despite the indescribable resistance of the Muslim warriors around The Messenger, defeat seemed inevitable until Ka'b ibn Malik, seeing The Messenger, shouted: "O Muslims! Good tidings for you! This is The Messenger, here!" The scattered Companions advanced toward him from all sides, rallied around him, and led him to the safety of the mountain.
The reasons for the setback at Uhud. Before explaining the reasons for this setback, it should be pointed out that the Companions, after the Prophets, are superior to everybody else in virtue. They are honored with being the comrades and trainees of Prophet Muhammad, the greatest of creation, the one for whose sake the universe was created and who was sent as a mercy for all the worlds. Therefore, according to the rule "the greater the blessing, the greater the responsibility," they had to be the most obedient to God and His Messenger. We read, for example, whoever of the Prophet's wives commits manifest indecency, the punishment for her will be doubled … you are not like any other women (33:30, 32). Likewise, even a small sin committed by a Companion deserves severe punishment. They are all included in those "foremost in belief and nearness to God," and their conduct is an example to be followed by later generations. Therefore, they must be pure in belief and intention, sincere in worship and devotion, upright in conduct, and extremely careful in refraining from sin and disobedience.
God raised the Community of Muhammad as the best community to enjoin the good and forbid the evil, and believe in One God (3:110) and appointed them as a middle nation so that they may be witnesses to humanity, and the Messenger may be a witness to them (2:143). In the early years of the Madinan era, the Companions consisted of true believers and Hypocrites. Therefore, God wanted to sift His true witnesses against all humanity, and see who strove hard in His Way and remained steadfast (3:141–42). The Battle of Uhud, therefore, was a decisive test to sift out the sincere and steadfast from the hypocritical and wavering, and served to make the Islamic community more stable and formidable.
After these preliminary notes, we can summarize why the Muslims experienced a setback as follows:
• The Messenger, the commander-in-chief, thought they should stay within Madina. The younger Companions, inexperienced and excited, urged him to march out of the city. This was a mistake, even though for the sake of martyrdom in the way of God, since the Messenger tended to apply different tactics in battles and knew in advance that the Quraysh army was coming to fight in an open field.
• The archers posted to defend the army left their posts. They misinterpreted the Messenger's order not to leave for any reason and went to collect booty.
• The 300 Hypocrites, one-third of the army, deserted half-way and returned to Madina. This undermined the morale of the Banu Salama and Banu Haritha tribes, who were only persuaded with difficulty not to leave. Moreover, there was a small group of Hypocrites who demoralized the Muslim ranks during the battle.
• Several Companions became impatient. They acted, in certain respects, inconsistently with the dictates of piety and were lured by material wealth.
• Some believers thought that as long as the Messenger was with them, and as long as they enjoyed God's support and help, the unbelievers could never beat them. However true this was, the setback taught them that deserving God's help requires, besides belief and devotion, deliberation, strategy, and steadfastness. They also perceived that the world is a field of testing and trial:
Many ways of life and systems have passed away before you; journey in the land, and behold how was the end of those who did deny (the Messengers). This is an exposition for humanity, and a guidance and an admonition for the God-fearing. Don't faint or grieve, for you shall gain mastery if you are true believers. If a wound has touched you, a like wound already touched the (unbelieving) people (at Badr); such days We deal out in turn among humanity, that God may see who are the believers, and that He may take witnesses from among you; and God loves not the evil-doers; and that God may prove the believers, and blot out the unbelievers. (3:137-41)
• Those who had not taken part in Badr sincerely prayed to God for martyrdom. They were deeply devoted to Islam and longed to meet God. Some, like 'Abd Allah ibn Jahsh, Anas ibn Nadr, Sa'd ibn Rabi', 'Amr ibn Jamuh, and Abu Sa'd Haysama tasted the pleasure of martyrdom; the martyrdom of the others was delayed. The Qur'an sings the praises of them as follows: Among the believers are men who were true to their covenant with God; some of them have fulfilled their vow by death (in battle), and some are still awaiting, and they have not changed in the least (33:23).
• Any success or triumph lies with God, Who does whatever He wills and cannot be questioned. Belief in God's Unity means that believers must always ascribe their accomplishments to God and never appropriate anything good for themselves. If the decisive victory of Badr gave some Muslims a sort of self-pride, and if they imputed the victory to their own prudence, wise arrangement, or some material causes, this would have been part of the reason for their setback.
• Among the Qurayshi army were several eminent soldiers and commanders (such as Khalid ibn Walid, Ikrima ibn Abi Jahl, 'Amr ibn al-'As, and Ibn Hisham) who were destined by God to be great servants of Islam in the future. They were the ones most esteemed and respected among the people. For the sake of their future service, God may not have willed to hurt their feelings of honor completely. So, as expressed by Bediuzzaman Said Nursi, the Companions of the future defeated the Companions of the present.
• The following verses explain the reasons for that setback together with its aftermath, and the lessons to be taken from it:
Did you suppose you should enter Paradise without God displaying which of you have struggled and who are patient? (3:142)
 Ibn Hisham, 3:99.
 Ibn Sa'd, Tabaqat, 8:413–5.
 Ibn Hanbal, 3:201; Bayhaqi, Sunan, 9:44.
Muhammad is naught but a Messenger; Messengers have passed away before him. Will you, if he should die or is slain, turn back on your heels? Whoever should turn back on his heels will not harm God in any way; and God will recompense the thankful. It is not given to any soul to die save by the leave of God, at an appointed time. Whoso desires the reward of this world, We will give him of this; and whoso desires the reward of the other world, We will give him of that; and We will recompense the thankful. (3:144–5)
God fulfilled His pledge to you when by His leave you blasted them, until you lost heart, and quarreled about the matter, and disobeyed, after He had shown you that you longed for. Some of you sought this world and some of you sought the next. Then He turned you from them, that He might try you; and He has pardoned you. God is bounteous to the believers. When you were going up, not twisting about for anyone, and the Messenger was calling you in your rear; so He rewarded you with grief after grief that you might not sorrow for what escaped you neither for what smote you. God is aware of the things you do. (3:152–3)
Those of you who turned away on the day two hosts encountered—Satan made them slip because of some of their lapses; but God has pardoned them. God is All-Forgiving, All-Clement. (3:155)
O believers, be not as the unbelievers who say concerning their brothers, when they journey in the land, or are upon expeditions: "If they had been with us, they would not have died and not been slain"—that God may make that an anguish in their hearts. For God gives life, and He makes to die; and God sees all that you do. If you are slain or die in God's way, forgiveness and mercy from God are a better thing than what they amass; if you die or are slain, it is unto God that you shall be mustered. (3:156–8)
If God helps you, none can overcome you; if He forsakes you, who can help you after Him? Therefore let the believers put all their trust in God. (3:160)
Why, when an affliction visited you, and you had visited twice over the like of it, did you say: "How is this?" Say: "This is from your own selves; God is powerful over everything." And what visited you, the day the two hosts encountered, was by God's leave, that He might mark out the believers and that He also might mark out the Hypocrites, to whom it was said: "Come, fight in the way of God, or repel!" They said: "If only we knew how to fight, we would follow you." They that day were nearer to unbelief than to belief. (3:165–7)
Count not those who were slain in God's way as dead. They are alive with their Master, by Him provided, rejoicing in the bounty that God has given them, and joyful in those who remain behind and have not joined them yet. No fear shall be on them, neither shall they sorrow, joyful in blessing and bounty from God, and that God leaves not to waste the wage of the believers. (3:169-71)
God will not leave the believers in the state in which you are, till He shall distinguish the corrupt from the good, and God will not inform you of the Unseen; but God chooses out of His Messengers whom He wills. Believe then in God and His Messengers; if you believe and avoid disobeying God, there shall be for you a mighty wage. (3:179)
The last stage of the Battle of Uhud and the campaign of Hamra' al-Asad. After this confusion ended, his Companions rallied around the Prophet, who was wounded and had fainted. Many of his Companions also were wounded. They retreated to mountain's safety. The Qurayshi army began to leave the battlefield, thinking they had revenged themselves for Badr. Seeing that they could not crush the Muslims' resistance, they mounted their camels and, leading their horses, headed for Makka.
The Messenger worried that the Makkans might return and launch another attack on Madina. On the second day of Uhud, therefore, he ordered those who had fought the day before to gather together and pursue the unbelievers. Although some of the Banu 'Abd al-Qays, appointed by Abu Sufyan, tried to discourage this line of action by saying: "The people have gathered against you, therefore fear them," this only increased the believers' faith. They retorted: God is sufficient for us; what an excellent Guardian He is! (3:173). 
Most were seriously wounded; some could not stand and had to be carried by their friends.  At this highly critical moment, they girded up their loins and prepared to lay down their lives at the Messenger's behest. They accompanied him to Hamra' al-Asad, eight miles from Madina. The Makkan polytheists had halted and were talking about a second attack on Madina. However, when they saw the believers they had supposedly just defeated coming toward them, they could not muster sufficient courage and so continued on to Makka.
The Messenger's prudence and military genius turned a defeat into a victory. The enemy did not have enough courage to confront the Muslims' resolution yet again by marching upon Madina, and so retreated to Makka. God revealed the following verses in praise of the Muslim heroes:
Those who answered God and the Messenger after the wound had smitten them—to all those of them who did good and behaved in utmost devotion to God, shall be a mighty wage; those to whom the people said: "The people have gathered against you, therefore fear them." But it increased them in faith, and they said: "God is sufficient for us; what an excellent Guardian He is!" So they returned with blessing and bounty from God, untouched by evil. They followed the good pleasure of God, and God is of bounty abounding. (3:172–74)
Toward the Battle of the Trench. The Jewish Banu Nadir tribe was originally the sworn ally of the Muslims in Madina. However, its members secretly intrigued with the Makkan pagans and the Madinan Hypocrites. They even tried to kill the Prophet while he was visiting them, breaking the laws of hospitality and their treaty. The Messenger asked them to leave their strategic position, about three miles south of Madina, and they agreed to do so. But when 'Abd Allah ibn Ubayy, the Hypocrites' chief, promised them help in case of war, the Banu Nadir demurred.
The Muslim army then besieged them in their fortresses. The Banu Nadir, seeing that neither the Makkan polytheists nor the Madinan Hypocrites cared enough to help them, left the city. They were dismayed, but their lives were spared. Given 10 days to leave, along with their families and all they could carry, most of them joined their brethren in Syria and others in Khaybar.
While returning from Uhud, Abu Sufyan had challenged the Muslims to a re-match at Badr the following year.  But when the appointed time arrived, his courage failed him. As a face-saving device, he sent Nu'aym ibn Mas'ud (then an unbeliever) to Madina to spread the rumor that the Quraysh were making tremendous war preparations and gathering a huge and invincible army. However, when the Prophet reached Badr with an army of 1,500 fighters, there was no enemy to meet him. They stayed there for 8 days, waiting for the threatened encounter. When no sign of the Quraysh army appeared, they returned to Madina. This campaign was called Badr al-Sughra (Badr the Minor).
In 5 ah, the Messenger was informed that the desert tribes of Anmar and Sa'laba had decided to attack Madina. Accompanied by 400 fighters, he reached Zat al-Riqa' and, hearing that the enemy tribes had fled, returned to Madina.  After this campaign, he marched upon the pagan Banu Mustaliq tribe, which had made preparations to fight the Muslims. With 700 warriors, the Messenger attacked and defeated them.  On the way back to Madina, the Hypocrites tried, and failed, to cause dissension among the Emigrants and the Ansar. The verses sent down revealed all their secrets and how polluted their inner world was (63:1-11).
 Ibn Hisham, 3:101.
 Ibn Hisham, 3:94; Ibn Sa'd, 2:59.
 Ibn Hisham, 3:213.
 Ibn Kathir, 4:178–9.