1. Use the "Peace Shield" item to protect your city from being attacked for a period of time (does not protect troops outside the city).
 
2. You can withdraw troops that are collecting resources if they're under attack.
 
3. You can send out troops to avoid casual ties if your city is under siege.
 
4. Use "Advanced City Teleport" items to flee hostility. Your enemy will be temporarily unable to discover your new location.
 
5. Build a Temple to prevent your troops from getting killed in battle. In this way, you can send wounded troops back to the battlefield quicker and for much fewer resources.
 
6. A League is always a powerful form of insurance. Your allies can send reinforcements to Embassy in your city. Your allies can support you more easily when your city is located nearby.