The Treaty of Hudaybiyya and the Pledge of Ridwan
The Prophet ﷺ went out to perform ʿUmra but Quraysh turned him back, so his Companions pledged to him under the tree unto death. Then came the treaty whose outward form was a hardship but whose inner reality was a conquest — and Allah named it a clear victory.
He ﷺ went out in Dhu'l-Qaʿda 6 AH with one thousand four hundred to perform ʿUmra, seeking no war, but Quraysh turned them back at Hudaybiyya. When it was rumoured that his envoy ʿUthman ibn ʿAffan had been killed, he called for the pledge, and they pledged to him under the tree not to flee. So Allah revealed: "Allah was well pleased with the believers when they pledged allegiance to you under the tree."
Then Suhayl ibn ʿAmr came and the treaty was concluded on a ten-year cessation of war, that the Muslims return that year and perform ʿUmra the next; and a condition that weighed heavily on the Muslims: that whoever came to Muhammad from Quraysh as a Muslim be returned to them — until ʿUmar said: Why should we give away a lowering in our religion?
Surat al-Fath was revealed on the way back: "Indeed We have granted you a clear victory." And Allah spoke truly; the people felt secure and mixed, and in two years as many entered Islam as had entered it before that, and the treaty was the prelude to the conquest of Makkah itself.
Note — differing reports on the date: It was in Dhu'l-Qaʿda 6 AH by agreement; the treaty was concluded near the end of the stay at Hudaybiyya, and its day is not definitively fixed.