Forum:Problems with freeing my town.

My town became occupied by some guy who wants me to stop attacking him. My (non-allied) friend then sent hundreds of units to help free that town. After I selected "free town" in the garrison view and clicked "join battle" in the island view (as I remember), my units joined behind my enemy's lines... I was fighting against my friend! Why is this, and how could I have helped free my town?