When an attack takes place on a target, the defending weapons are "collected" to execute the defense.
These include a possible garrison at the target, in case of a military unit, its defensive weapons.
A defensive air unit is called to participate (the strongest one within range), mobile military units that are within range (20 miles) will also participate.
fed members could participate too.
a federation air wing will participate, and if available, also a mobile unit within range.
Defensive nukes will participate if they are within range (40 miles)
This is obviously an advantage of mobile units that are participating in the defense.