Towards the second year of the hijrah, the idolaters of Mecca began a series of hostile acts against the Muslims of Medina. They sent men in parties to commit depredations on the fruit trees of the Muslims of Medina and to carry away their flocks. Now came the moment of severest trial to Islam. It became the duty of the Prophet to take serious measures to guard against any plot rising from within or a sudden attack from without. He put Medina in a state of military discipline. He had to send frequent reconnoitering parties to guard against any sudden onslaught.
No sooner did the Prophet organize his state than a large well-equipped army of the Meccans was afield. A force consisting of one thousand men marched under Abu Jahl, a great enemy of Islam, towards Medina to attack the city. The Muslims received timely notice of their enemies' intention. A body of three hundred adherents, of whom two thirds were citizens of Medina, was gathered to forestall the idolaters by occupying the valley of Badr, situated near the sea between Mecca and Medina. When the Prophet saw the army of the infidels approaching the valley, he prayed that the little band of Muslims might not be destroyed.
The army of the Meccans advanced into the open space which separated the Muslims from the idolaters. According to Arab usage, the battle was begun by simple combats. The engagement then became general. The result of the battle was that the Meccans were driven back with great loss. Several of their chiefs were slain, including Abu Jahl. A large number of idolaters remained prisoners in the hands of the Muslims. They were, contrary to all usage and traditions of the Arabs, treated with the greatest humanity. The Prophet gave strict orders that sympathy should be shown them in their misfortune and that they should be treated with kindness. These instructions were faithfully obeyed by the Muslims to whose care the prisoners were confided. Dealing with this event, Sir William Muir, in his book Life of Muhammad, quotes one of the prisoners saying: "Blessing be on the men of Medina; they made us ride, while they themselves walked; they gave us wheaten bread to eat, when there was little of it, contenting themselves with dates."