According to the Hudaybiyya peace treaty, all tribes were permitted to ally either with the Muslims or the Quraysh, as they wished. The tribe of Khuza'a allied with the Prophet (s) and Banu Bakr allied with the Quraysh. In 8 AH, Banu Bakr fought the tribe of Khuza'ah, and the Quraysh supported Banu Bakr in this battle. In this way, the Quraysh had broken the Hudaybiyya peace treaty since they had fought against one of the Prophet's (s) allies. Abu Sufyan then realized that such a violation would have consequences, and rushed to Medina to attempt to renew the treaty, but he could not.
In the month of Ramadan in 8 AH, the Prophet (s) went to Mecca with 10,000 Muslims. He began his trip while nobody knew of it. When they arrived, they stayed in a place called Marr al-Zahran. Abbas, the Prophet's uncle went out of his tent at night, and searched for some Meccans in order to tell them to inform the Quraysh about the Prophet's (s) trip to Mecca. This was so that they could come to the Prophet (s) before he arrived in Mecca and killed the Quraysh. However, he suddenly saw Abu Sufyan, sheltered him, and took him to the Prophet (s).
Abu Sufyan then became a Muslim. The following day, the Prophet (s) ordered Abbas to make Abu Sufyan stand in a place where he could see the Muslims accompanying the Prophet (s) passing by. When Abu Sufyan saw their glory and the massive number of Muslims, he told Abbas, "the kingdom of your nephew has grown!" Abbas said, "This is the prophethood, not the kingdom!" Abu Sufyan replied,"Yes, Indeed!" Then Abbas went to the Prophet (s) and told him that "Abu Sufyan is the type of person that wants to have privilege." The Prophet (s) said that "Everyone [in Mecca] who goes to his house and shuts their door will be safe. Also, anyone who is sheltered in Abu Sufyan's house will be safe as well.
Anyone who enters Masjid al-Haram will also be safe." The great crowds of Muslims entered Mecca. Ibn Hisham narrates from Ibn Ishaq that Sa'd b. 'Ibada, the chief of the tribe of Khazraj had come to Mecca that day and said, "Today is the day of massacre! Today is the day of disrespect and the violation of sanctity." He wanted to take revenge on the Quraysh and the 'Adnani families and sought revenge for the people of Medina. To avoid the misconception that the Islamic victory would be a form of tribal revenge, the Prophet (s) sent Ali (a) and told him, "Take the flag from Sa'd for today is the day of mercy." There was no fight between the Meccans and Muslims, save for a few arguments.
The Prophet (s) went to Masjid al-Haram and circumambulated the Kaaba seven times and then stood at the front of its door and said, "There is no god except Allah alone, He has no partner. True is His promise and He helps His servant and defeats the factions alone."
People abandoned all other work except for serving the Kaaba and giving water to the pilgrims. The Prophet (s) stayed in Mecca for two weeks and arranged for different jobs to be done. Among these, was sending some people around Mecca to destroy any idols or idol houses, and further, to destroy the idols that were in the kaaba. The noble way that the Prophet (s) treated the Meccans showed the glory of Islam and the nobility of the Prophet in front of the former opposition to Islam.
The Quraysh, who did not hesitate to harass the Prophet (s) and his followers in every possible way for twenty years, feared the punishment that they would face. When they heard the Prophet (s) say, "I free all of you!" they became determined to fight against the infidels instead of fighting against Islam.