Sometimes it may seem as if you were attacked when you should have been protected by a shield or a Village Guard. While this may seem like the case, keep in mind that it's impossible for players to attack a village with an active shield/guard.

A shield or guard removes you from the matchmaking pool of "available" villages found when other players are looking for targets. Your village showed up and was attacked, which indicates that for some reason your shield/guard was cancelled prior to the attack. This usually happens when another person, like a friend or a family member, has access to the same device and game. It can also happen by accident if the player's mobile device's touchscreen is left accidentally unlocked.