There are two types of Units: offensive and defensive. The designation of the units and their total offensive/defensive rating against each respective unit category is more important to the outcome of each battle than the total number of units. If your Sector was attacked while only having a garrison of Offensive units, they will most like be unable to repel the enemy - their defensive stats are too low - and will die. Remember to only use Offensive units for attacks, and only Defensive units for defense. If you mix them together, both will fight in both defensive or offensive battles and you run the risk of wasting your army. In addition to the number of units and their designations, the outcome of the battle is also determined by each unit's individual stats, Sector Defense Bonuses, reinforcements, and their respective upgrade levels.