Narrated Al-Bara (RA) :
When the Prophet ﷺ went out for the Umra in the month of Dhal-Qada, the people of Makkah did not allow him to enter Makkah till he agreed to conclude a peace treaty with them by virtue of which he would stay in Makkah for three days only (in the following year). When the agreement was being written, the Muslims wrote: "This is the peace treaty, which Muhammad, Apostle of Allah ﷺ has concluded."
The infidels said (to the Prophet), "We do not agree with you on this, for if we knew that you are Apostle of Allah ﷺ we would not have prevented you for anything (i.e. entering Makkah, etc.), but you are Muhammad, the son of Abdullah." Then he said to Ali, "Erase (the name of) Apostle of Allah." Ali said, "No, by Allah, I will never erase you (i.e. your name)." Then Allahs Apostle ﷺ took the writing sheet...and he did not know a better writing..and he wrote or got it the following written! "This is the peace treaty which Muhammad, the son of Abdullah, has concluded: "Muhammad should not bring arms into Makkah except sheathed swords, and should not take with him any person of the people of Makkah even if such a person wanted to follow him, and if any of his companions wants to stay in Makkah, he should not forbid him."
(In the next year) when the Prophet ﷺ entered Makkah and the allowed period of stay elapsed, the infidels came to Ali and said "Tell your companion (Muhammad) to go out, as the allowed period of his stay has finished." So the Prophet ﷺ departed (from Makkah) and the daughter of Hamza followed him shouting "O Uncle, O Uncle!" Ali took her by the hand and said to Fatima, "Take the daughter of your uncle." So she made her ride (on her horse). (When they reached Medina) Ali, Zaid and Jafar quarreled about her. Ali said, "I took her for she is the daughter of my uncle." Jafar said, "She is the daughter of my uncle and her aunt is my wife." Zaid said, "She is the daughter of my brother." On that, the Prophet ﷺ gave her to her aunt and said, "The aunt is of the same status as the mother." He then said to Ali, "You are from me, and I am from you," and said to Jafar, "You resemble me in appearance and character," and said to Zaid, "You are our brother and our freed slave." Ali said to the Prophet ﷺ Wont you marry the daughter of Hamza?" The Prophet ﷺ said, "She is the daughter of my foster brother."