Why did my troops defend after I set them to hide?
Troops will not hide if another user has already sent a march to attack your city. If you have already received the sentinel report for the oncoming attack, it will be too late to set your city to defend. This is because the players who are sending a march to your city will typically, instantly speed their attack to completion with a speed-up, when this occurs, the system will start to process the attack.
Additionally, if you are experiencing a game issue such as a display/refresh issue caused by outdated software, unsupported third party add ons or programs, or corrupted internet file data, it is possible the Defend/Hide function will fail to properly recognize their action and switch over.