If Allāh should aid you, no one can overcome you; but if He should forsake you, who is there that can aid you after Him? And upon Allāh let the believers rely.
Among the Qualities of Our Prophet Muhammad are Mercy and Kindness
Allah addresses His Messenger and reminds him and the believers of the favor that He has made his heart and words soft for his Ummah, those who follow his command and refrain from what he prohibits.
فَبِمَا رَحْمَةٍ مِّنَ اللَّهِ لِنتَ لَهُمْ
(And by the mercy of Allah, you dealt with them gently) 3:159. meaning, who would have made you this kind, if it was not Allah's mercy for you and them. Qatadah said that,
فَبِمَا رَحْمَةٍ مِّنَ اللَّهِ لِنتَ لَهُمْ
(And by the mercy of Allah, you dealt with them gently) means, "With Allah's mercy you became this kind." Al-Hasan Al-Basri said that this, indeed, is the description of the behavior that Allah sent Muhammad with. This Ayah is similar to Allah's statement,
In the first verse (16o) here, the recurring sense of grief that gripped the noble Companions after what happened at the battle of Uhud is being removed through elegant counsel. Verses 161-164 declare that the station of Allah's messenger is free of failings, that he exhibits the highest standard of trustworthiness, and that the very presence of his on the face of the earth is a great blessing and a favour shown to the people of the world.
Verses 165-167 explain the reason why Muslims faced hardships at Uhud, while refuting the view of the hypocrites alongwith it in verse 168.
Towards the end, in verses 169-171, it has been said that those who lay down their lives in the way of Allah achieve the ultimate success, real, permanent and full. Details follow.
Tazkirul Quran
Maulana Wahiduddin KhanOn ayahs 160–162
The gentle way the Prophet is asked to deal with the believers (in this context those who had disobeyed him in quitting their posts, incurring defeat in the battle) is equally essential in any Muslim leader. Moderation is indispensable for him. This lenient attitude is required not only in normal, daily life but also in dealings between Muslims and non-Muslims, even where, due to the disobedience of certain people, a victory turns into a defeat. Unless the leader shows broad-mindedness and high thinking, a powerful polity cannot be established. Mistakes, however grave their outcome, if committed without any evil intention, are pardonable. The leader, therefore, should overlook this type of error while dealing with people. He should be such a great well-wisher of his people that he should pray to God for their guidance. Indeed, the good leader so values his people that he takes decisions on matters of importance only after consulting them.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.