After mass migration from Mecca in 622 A.D., the Prophet and his followers made their position stronger in Medina. Six years later, they decided to go back to Mecca for performing lesser pilgrimage (Umra). To make the Meccans fearless about any possible military invasion, the Muslim pilgrims left behind battle-grade weapons. Still, they would not let the Muslims in Mecca, not as much for fear as for prestige. They stopped them at Hudaibiah near Mecca. Based on negotiation, the Prophet reached an agreement with the Meccan leaders.
Major terms of the contract included: (i) The Muslims would go back to Medina without performing pilgrimage this time. The following year they would go to Mecca and stay there for only 3 days. (ii) There would be one-way extradition: escapees from Mecca to Medina will be turned back but that will not happen in case of those who would flee from Medina to Mecca. (iii) There will be peace for 10 years and during this time both parties would remain neutral in case one of them fights with a third party.
Notable from the above agreement is that the terms of contract were mostly dictated by the Meccans and therefore they went against the immediate interest of the Muslims. For example, they postponed their important pilgrimage rituals and Islamic-minded escapees to Medina were to be sadly forced back to infidel society of Mecca. This seemed like an apparent defeat for the Muslims who had reasons for their resentment. However, the Prophet under spiritual guidance of God, agreed to the contract which finally proved to be a blessing in disguise. In exchange for relatively small sacrifices for now, the Muslims bought much needed years of peaceful time to grow in strength. Ultimately that is exactly what happened as the powerful Muslims made victorious return to Mecca later in 630 A.D. The following lessons follow from the above:
(i) Even though your Islamic mission may have the backing of Almighty God and you are supposed to rely on Him, you should not ignore the reality on the ground. It does not make religious sense to jump into trouble by attempting to fight empty-handed against an armed enemy. Sometimes you may get direct help from God (ex: Battle of Badr), but not always (ex: Battle of Uhud). You should therefore be realistic while dealing or interacting with those who are around you.
(ii) Apart from being realistic, you also need to be diplomatic by applying your prudence, and wisdom, with vision into your long term interest.