Without knowing the exact setup, including who was in who's realm, and the diplomacy, and where everyone was the turn before, and what their unit status was, etc., it's almost impossible to tell you anything with any certainty.
However, there is a fall-back for the combat script: If all else fails, the side with the larger force is the defender. That's probably what happened to you.