Ummm, it was a private installation and they were security with legal authority to protect it. Coulson and team were trespassing, breaking and entering, destroying private property, and stealing. Killing the guards while committing criminal offenses is first degree murder (may vary depending on jurisdiction?) Setting legalities aside it was a case of willfully killing two people because you didn't want your friend to die. If they were security guards at a common hospital, would it be OK?
I don't know where you're getting they had legal authority or where anything in there was legal.
It's a little late for me to get into a big debate, so I'll raise a couple thoughts.
If you are on a boat and there's a storm about to destroy your boat. If you dock it at someone's dock and take shelter in their home, have you committed a crime? The answer is generally "no" through the defense of necessity.
If you break into a home to steal water when you would otherwise die of dehydration, is it a crime?
If you break into a home to steal water and trigger a shotgun trap the owner had set up, which shoots you in the face, has the owner committed a crime?
Finally, if you break into a home to steal water and the owner attacks you and, in the struggle, you end up killing him, has anyone or both committed a crime?
ETA: I'll throw in this one: A burglar enters your home. You somehow (through clairvoyance) know for a fact that he is only going to steal your TV and won't harm you. May you shoot him?