After the Hajj in the tenth year, the following verse was revealed:
"This day I (God) have perfected your religion for you, completed my favor upon you, and have chosen for you Islam as your religion" (Qur'an 5:3)
Allah also said:
"You are the best people sent out to mankind. You instruct that which is good and dissuade from that which is evil and you believe in God." (Qur'an 3:111)
Allah also took it upon Himself to personally preserve this religion (by preserving the book). He said:
"Verily, It is We who have sent down 'the Reminder' (the Qur'an), and it is We who shall preserve it" (Qur'an 15:9)
It was at this time that the following chapter was revealed:
"When comes unto you (O Muhammad) the aid of Allah, and the conquest (of Makkah), and you saw the people enter into the religion in waves, then glorify the praises of your Lord, and ask His forgiveness. Verily, He is the one who accepts the repentance and forgives." (Qur'an 110)
When the companions of Muhammad (pbuh) heard this chapter being recited they understood that the prophet Muhammad (pbuh) would not be with them much longer and their hearts began to weigh heavy with the thought of losing him. In this final year of Muhammad's life, he redoubled his efforts in worship, in the praise of his Lord, and in the recitation of the Qur'an in preparation for his final journey. The illness which finally claimed the life of the messenger of Allah began in the second month of the eleventh year after the emigration.
Muhammad (pbuh) had taught his followers that Allah is Just. He repays goodness with goodness and exacts retribution for evil. However, he also is Merciful. He multiplies all good deeds from ten to many hundreds of times and He counts an evil deed as a single evil deed or He forgives it.
Of the ways that Muhammad (pbuh) taught us that Allah bestows His mercy upon us is that He occasionally ordains upon us trials in this life. The evil among mankind lose hope when inflicted with such trials and engross themselves in further evil. The faithful among them, however, are blessed by this trial. That is because they accept the trial and seek it's reward. The reward is then either bestowed upon them in this life or in the hereafter. Trials are also inflicted upon mankind to erase their sins or to multiply their reward so that on the day of judgment when they are presented with the reward of their perseverance and compliance, they would wish that they had been inflicted with a thousand such trials.
Similarly, when Muhammad (pbuh) was stricken with this illness, it ravaged him and sapped his strength. He would tie a piece of cloth around his head in order to reduce the severity of the migraines that would afflict him, and when he wished to move about he would lean upon the shoulders of two men as they guided him to his destination. This continued for a little over a month until he finally passed away in the third month of the eleventh year after the emigration.
As Muhammad (pbuh) was on his death bed he asked his wife Aisha: "O Aisha, what news of the gold?" (what money do we posses?). She came to him with between five and nine pieces which were all they owned. As he overturned them in his hand he said: "What shall Muhammad say if he met his Lord and these are in his possession? Dispose of them [O Aisha]! (in charity)"
After leading the Muslims for the last time in prayer, Muhammad sat upon the "minbar" in the masjid and delivered the "sermon of parting." Among his words in this speech he said:
"Allah gave a choice to one of [His] slaves either to choose this world or what is with Him in the hereafter. He chose the latter."
Abu-Bakr understood the meaning of these words and began to weep bitterly, saying: "Rather, we would sacrifice ourselves and our children for you O messenger of Allah." The Prophet (pbuh) said: "O Abu-Bakr! Don't weep. There is none among mankind more beloved to me in his self and his money than Abu-Bakr. And were I to take a confidant in this life I would have taken Abu-Bakr as my confidant. However, the confidence of Islam is better." He then commanded that all doors into the masjid be closed except the door of Abu-Bakr. When Muhammad (pbuh) became too ill to lead the daily prayers, he commanded that Abu-Bakr assume this responsibility.
Aisha the wife of Muhammad (pbuh) narrated "The Messenger of Allah, may Allah bless him and grant him peace [once] said, 'No prophet dies until he is given the choice (between being a king on earth or receiving the reward of the hereafter).'" She continued, "[While on his death bed] I heard him say, '[Rather] In the highest company. In the highest company' and I knew that he was departing." (Narrated in the Muwatta by Malik)
On the day of Muhammad's passing, he pulled back the curtain between his room and the masjid and watched the Muslims as they followed Abu-Bakr in prayer. He was pleased with this sight and with having lived to see his followers upholding the religion and devoted to their prayer. He smiled as he watched them. The Muslims saw him as he peered through the curtain at them and joy began to overcome their hearts. He looked so much healthier than they had come to expect, perhaps he had been cured? Muhammad (pbuh) gestured to them to continue their prayers and he drew the curtain closed again. It was not long after that he passed away.
The last verse of the Qur'an revealed by Muhammad (pbuh) was:
"And guard yourselves against a day when you shall be returned to your Lord, then every soul shall be paid in full that which it earned and they shall not be wronged." (Qur'an 2:281)
The last words uttered by Muhammad (pbuh) before his death were a warning to his followers against their taking his grave as a place of worship. He then advised the Muslims to attend to their prayers, their charity, and that which their right hands do possess (do well by their slaves). Muhammad was sixty three years old when he passed away, having spent exactly twenty three years in the call to Islam, the belief in one God, and the eradication of all false gods other than He.
Shortly after Muhammad (pbuh) passed away, Abu-Bakr was elected the first "Khalifa" (Caliph) in Islam. He ruled them until his death and then he was followed by Umar ibn Al-Khattab, then Uthman ibn Affan, then Ali ibn Abi-Talib. These four were later named the four "Rightly Guided Caliphs." Jerusalem was opened by Umar in the year 641 during the period of his rule. He entered into it riding upon a donkey, thus fulfilling the prophesy of Zachariah 9:9 (please see point 43 in the table of section 2.2).
After the Muslims captured Jerusalem the Jews and Christians were not forced to convert but were allowed to continue their worship and pilgrimage freely. As a supreme example of the tolerance all Muslims are commanded for the religious practices of others, when Caliph Umar received the keys to Jerusalem from the patriarch Sophronius in the 7th century he was then asked to pray in a Jerusalem church, he refused saying he did not want to provide a pretext for Muslims to appropriate a Christian holy site. During Caliph Umar's rule the mighty Sassanian (Persian) dynasty too fell before the Muslims.
Abu-Hurayra said: I heard Allah's Messenger (pbuh) saying:
"My example and the example of the people is that of a man who lit a fire, and when it was lit, the things around it, moths and other insects started falling into the fire. The man tried [his best] to prevent them, [from falling in the fire] but they overpowered him and rushed into the fire." The Prophet (pbuh) added: "Now, similarly, I am grasping your belts to prevent you from falling into the Fire, but you insist on plunging into it." (narrated by Al-Bukhari)