Probably the AI army thinks that it is defending the city. It is defending but someone has to inform it that it's looking things inside out!

("No, this is not your city, these are not your towers...", "Sorry to tell you but you are getting killed here...")

Hope the developers can do some teaching.

(Until then I'll be using it )