Whenever the Messenger of Allah ﷺ returned from a military expedition, a Hajj, or an Umra, he 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, to Him belongs all praise, and He has power over all things. Returning, repenting, worshipping, prostrating, praising our Lord. Allah has fulfilled His promise, granted victory to His servant, and alone defeated the confederates."
أن رسول الله ﷺ كان إذا قفل من غزو أو حج أو عمرة، يكبر على كل شرف من الأرض ثلاث تكبيرات، ثم يقول: لا إله إلا الله وحده لا شريك له، له الملك وله الحمد وهو على كل شيء قدير، آيبون تائبون عابدون ساجدون لربنا حامدون، صدق الله وعده، ونصر عبده، وهزم الأحزاب وحده.
Malik narrated it in the Hajj chapter (243), from Nafi, from Ibn Umar, and he mentioned it. Bukhari narrated it in the Hajj chapter (1797), and Muslim in the Hajj chapter (1344), both by way of Malik, with the same chain. Bukhari's wording is the same. As for Muslim, he related it with the wording of Ubaydullah bin Umar, from Nafi, with the same chain, saying, "The Messenger of Allah ﷺ, whenever he returned from military expeditions or raiding parties or Hajj or Umrah, and climbed a mountain pass or a rugged elevated place, would say the takbir three times. Then he said" (and he mentioned it in the same manner as Malik's narration).His saying, "climbed" means he ascended. And his saying, "a rugged elevated place" is said to refer to a place that has roughness and elevation. This supplication has also been established from Bara, Anas, and Jabir, as Tirmidhi stated (950), except that they did not mention Hajj and Umrah in their narrations. It will be mentioned later in the Book of Supplications.