The Messenger of Allah ﷺ was in Mecca, then he was commanded to migrate, and Allah revealed to him "And say, My Lord, cause me to enter a sound entrance and to exit a sound exit and grant me from Yourself a supporting authority" [Isra 17:80].
حدثنا جرير عن قابوس عن أبيه
كان رسول الله ﷺ بمكة ثم أمر بالهجرة وأنزل عليه {وقل رب أدخلني مدخل صدق وأخرجني مخرج صدق واجعل لي من لدنك سلطانا نصيرا}