The Messenger of Allah ﷺ, whenever he returned from a military expedition, Hajj, or Umra, would say "Allahu Akbar" three times upon every elevated point of land, then he would say, "There is no god but Allah alone, with no partner. To Him belongs the dominion and to Him belongs all praise, and He is capable of all things. We are returning, repenting, worshipping, prostrating to our Lord, and praising Him. Allah has fulfilled His promise, granted victory to His servant, and defeated the confederates alone."
أن رسول الله ﷺ كان إذا قفل من غزو أو حج أو عمرة يكبر على كل شرف من الأرض ثلاث تكبيرات، ثم يقول: لا إله إلا الله وحده لا شريك له، له الملك وله الحمد، وهو على كل شيء قدير، آيبون، تائبون، عابدون ساجدون لربنا حامدون، صدق الله وعده، ونصر عبده، وهزم الأحزاب وحده.
Malik narrated it in Hajj (243) from Nafi, from Abdullah bin Umar, and he mentioned it. Bukhari narrated it in Dua (6385), and Muslim in Hajj (1344), both through the route of Malik with the same wording. Muslim did not give the full wording, but instead referred to the narration of Ubaydullah bin Umar, from Nafi, which is similar in meaning.His saying, "Then he says, There is no god but Allah..." means that he says this supplication, along with what is mentioned in this chapter, after the supplication for riding, which is, "Glory be to the One who has subjected this to us..." to the end of it. This is because it has been reported at the end of the supplication for riding that when he returned he would say these words and add to them, "We return, repentant..." and so on.