Generally these situations don't arise without warning. When they're getting started the govts often advice their nationals to get the hell out of dodge. Those who choose not to get out are left to their own devices. In some of these mideast contractor gigs, the companies have their own security which amounts to mercenaries. That has good points and bad but I guess it gets the job done.