I just attacked a walled city (walled by me, taken by enemy), where the enemy broke the wall from the inside and i attacked from a walled city.
In the battle, my troops were defending instead of attacking and i didnt take the city, although it had 0 units inside and i had 20 out in the end of the battle