Fundamental theorem on gauge fixing at the action level