You can set a Denfence Hero on the Wall, and keep enough troops in the City to resist attack. Also Allies’ reinforcements would be of great help.
If your enemy is much more powerful, you can put on a Peace Shield to avoid war before your enemies arrived.