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 place in the land, then say, "There is no god but Allah alone, with no partner. To Him belongs the dominion, and to Him belongs all praise, and He has power over all things. 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."
حدثنا القعنبي عن مالك عن نافع
أن رسول الله ﷺ كان إذا قفل من غزو أو حج أو عمرة يكبر على كل شرف من الأرض ثلاث تكبيرات ويقول لا إله إلا الله وحده لا شريك له له الملك وله الحمد وهو على كل شيء قدير آيبون تائبون عابدون ساجدون لربنا حامدون صدق الله وعده ونصر عبده وهزم الأحزاب وحده
Bukhari reported it in the Book of Umrah, chapter on what one says when returning from Hajj, Umrah, or a military expedition, no. 1797, and Muslim in the Book of Hajj, chapter on what one says when returning from a journey of Hajj or otherwise, no. 1344, both from the hadith of Malik through this chain, and it is also found in the Muwatta (narration of Yahya): 1/421.