The 30-foot flames licked the Afghan sky as alarms wailed and fire crews struggled to hold back an inferno sparked by a rocket attack.

Water was running short and the spreading fire was threatening a base hospital full of wounded U.S. servicemembers.

Air Force Senior Master Sgt. Gene Jameson could see the fire and hear the sirens from the other side of the flight line. Jameson was working late on his deployment to Bagram with a communication squadron that kept everything from cellphone to satellite links up and running.

At the same time, Senior Master Sgt. Jim Lambert stepped out of a base gym. Lambert, a member of Jameson’s communications squadron and a civilian firefighter, had heard the 107mm rocket explode.

Both moved toward the fire and commotion, starting a chain of events on Aug. 20, 2011, that would earn them each a Bronze Star with “V” for valor.

They met in the humming emergency operations center. Reports streamed in. Crews kept calling for more water, a scarce commodity on Bagram. The situation was deteriorating and a hospital evacuation seemed imminent.

Lambert had 10 years of experience as an urban search-and-rescue technician and paramedic for a municipal fire department. The work had trained him to deal with structure fires.

“When they said, ‘This is burning out of control,’ I knew they were overwhelmed and nobody else was coming,” Lambert said.

Jameson and Lambert approached a colonel who was leading the effort. Lambert knew the only way to stop the blaze was to create a fire break by destroying nearby buildings and removing potential fuel. They drew up a plan on the base map. The colonel was willing to give them a shot and asked what they needed.

More than five acres were burning with flames so hot that 40-foot conical containers were reduced to ash. Large metal shipping containers melted. It was unclear who was in charge.

Lambert started directing about a dozen servicemembers in an effort to cut the fire break.

“I saw a spot I thought we could defend and we started knocking buildings down,” he said. “We were in a spot that if we didn’t stop it here, there would be no way to stop it.”

Meanwhile, Jameson and his crew with heavy equipment were dealing with a terrifying discovery.

The United Arab Emirates kept an all-inclusive compound on Bagram. The barricaded building had been evacuated, but all the ammunition and ordnance had been left behind. The arsenal, along with a huge generator with fuel tanks, was sitting in the path of the fire.

Base firetrucks were blocked from the compound by barriers and fences. They sprayed precious water ineffectively onto the UAE building from outside. The firefighting efforts had grown so desperate that crews were using sewage water from portable toilets.

With the fire lapping at their backs, Lambert told Jameson, “Get me in there.”

Lambert directed the heavy equipment to ram a hole in the barriers. A front-end loader made a run but broke its drive train and had to be dragged aside. The team pushed a broken-down bus away and punctured a UAE water tank near the generator fuel to reduce the risk of an explosion.

Still, they could not punch a passage large enough to get water trucks into the compound. The fire had already arrived. Jameson and Lambert went into the two-story compound on foot.

“Every possible hazard you learn about in [firefighting] school was in there,” Lambert said.

There were canisters of acetylene and drums of ether and oil. The two airmen began carrying the flammable chemicals out of the compound. Explosions sounded randomly and M-16 rounds cooked off in the fire as they worked.

Lambert found crates of grenades next to a fully engulfed building. They were likely to explode at any moment.

“There were a handful of people I had that I knew,” he said. “We started humping all these hand grenades to a clear zone we had created.”

All his civilian firefighter training was telling him that nobody should be near the burning UAE facility. The thought that he might die in the fire kept leaping into his mind but he pushed it aside. The blaze was a threat to everyone on Bagram.

Inside the burning compound, Jameson tripped over something. He looked down and saw a crate with large labels warning of “mass detonations with high secondary explosions.” It was a store of anti-tank missiles.

Just then, a building collapsed and blocked the escape route. Jameson and a sergeant were left standing inside the compound next to the tank missiles and a crate of grenades.

“The fire was right on top of us,” Jameson said.

The only way out appeared to be a long passage between two flaming buildings. The path was about 150 yards long and about five yards wide. The ordnance weighed 250 pounds — too heavy to carry. The fire on each side reached three stories into the night sky.

“We have to take these with us,” Jameson said, talking about the missiles and grenades.

They pulled a partially melted pallet jack out of the fire and let it cool for a moment, then loaded up the crates of explosives. They pushed them down the long narrow space between the fire.

“We really couldn’t see where we were going because the smoke was so thick,” Jameson said. “We were choking on the smoke.”

The fire raged for five hours before being stamped out. Acres had been lost but Bagram had been saved.

Later, the military would say Lambert’s leadership saved the lives of 50 emergency workers and halted the fire from spreading to about 90 vulnerable facilities, heading off millions of dollars in damage.

Jameson’s decision to pull the ordnance from the fire also saved the lives of all the emergency workers on the scene that day, according to the military.

“In my mind I always make a to-do list,” he said. “When I found those explosives, my to-do list now was to get these out of here. There was never a time when we were going to leave those explosives behind.”