The Messenger of Allah ﷺ would not launch military campaigns during the sacred month unless he was attacked or about to be attacked. Whenever the sacred month arrived, he would remain in place until it had passed.
لم يكن رسول الله ﷺ يغزو في الشهرالحرام إلا أن يغزى-أو يغزوا- فإذا حضر ذلك أقام حتى ينسلخ.
Ahmad (14583) narrated it from Hujayn bin Muthanna, who said, Layth narrated to us, from Abu Zubayr, from Jabir, and he mentioned it. Its isnad is sahih. Abu Zubayr is Muhammad bin Muslim bin Tadrus Makki, and Layth is Ibn Saad. Layth would only narrate from Abu Zubayr what he knew Abu Zubayr had heard from Jabir.His statement, "So when that occurs, he stays until it is over," means that if the enemy attacks, he defends Islam and its people until the enemy is repelled.