Ali ibn Abi Talib (Arabic: علي بن أبي طالب, romanized: ʿAlī ibn Abī Ṭālib) Abu al-Hasan Ali ibn Abi Talib al-Hashimi al-Qurashi, the cousin and son-in-law of the Prophet Muhammad (peace and blessings be upon him), was a member of his family, one of the People of the Cloak, one of his companions, one of the scribes of the revelation, the fourth of the Rightly Guided Caliphs according to Sunni Islam, and the first Imam and successor of the Prophet according to Shia Islam. He was the father of Imams al-Hasan and al-Husayn (peace be upon them) and the grandfather of nine other Shia Imams.
After the Prophet, no one in Islam equals Ali ibn Abi Talib in his virtues. Therefore, the Prophet bestowed upon him the title "Commander of the Faithful."
He was born in Mecca, inside the Kaaba, to Fatima bint Asad al-Hashimiyya. No one in history had ever been born inside the Kaaba before. When he and his mother left the Kaaba, its wall (at the Yemeni Corner) cracked. Every year, the Saudi rulers repair this crack, but it reappears. He embraced Islam before the Prophet's migration (Hijra), and he was the first man to believe in the Prophet (and, after Khadija, the second person to convert to Islam). He migrated to Medina three days after the Prophet's migration, and the Prophet Muhammad established brotherhood between him and himself when he formed brotherhood among the Muslims. He also gave him his daughter Fatima in marriage in the second year of the Hijra.
He participated in all of the Prophet's battles except for the Battle of Tabuk, where the Prophet Muhammad left him in charge of Medina. He was known for his horsemanship, courage, and skill in combat, and he played a significant role in the Muslims' victories in battles, most notably the Battle of the Trench and the Battle of Khaybar. He was a trusted confidant of the Prophet Muhammad, and he was one of the scribes of the revelation and one of his most important ambassadors and advisors.
After the Prophet (peace and blessings be upon him and his family) completed the Farewell Pilgrimage, and in accordance with the verse of proclamation, he commanded the people to gather at Ghadir Khumm. He then delivered the Sermon of Ghadir, raising the hand of Imam Ali (peace be upon him) and saying, “Whoever I am his master, then this Ali is his master. O God, befriend whoever befriends him and oppose whoever opposes him.” Some of the Companions, such as Umar ibn al-Khattab, congratulated Imam Ali (peace be upon him) on his appointment as Commander of the Faithful after this sermon, and bestowed upon him the title “Commander of the Faithful.” Shia commentators and some Sunnis believe that the verse of completion was revealed on this day. The Shia derive the meaning of the caliphate after the Prophet (peace and blessings be upon him and his family) from the phrase “Whoever I am his master, then Ali is his master,” which the Prophet (peace and blessings be upon him and his family) uttered on the Day of Ghadir. Based on this, the Shia believe that their identity and what distinguishes them from other sects is their belief in the divine appointment of Imam Ali (peace be upon him) as the Prophet’s successor, in contrast to the Sunni view that the Prophet’s successor is chosen by the people.
During the reigns of the first three caliphs, Imam Ali (peace be upon him) generally remained aloof from political and governmental affairs, dedicating himself instead to providing scholarly and social services. These included compiling the Holy Quran, which became known as the Mushaf of Imam Ali (peace be upon him), advising the caliphs on various matters such as judicial matters, providing for the poor, purchasing and freeing a thousand slaves, cultivating and planting trees, digging canals, building mosques, and endowing properties and lands, the revenues of which may have reached four thousand dinars.