It's every commuter's nightmare: A terrorist bombs a subway car in an underground tunnel, killing passengers and trapping dozens in the smoking rubble. Meanwhile, another cell releases a chemical agent in the subway, and the invisible poison kills hundreds and sickens thousands.

To meet these deadly threats — which became a reality in London in 2005 and in Tokyo 10 years earlier — the U.S. government is developing a tool to counteract the subterranean terrors: a giant tunnel plug.

• Click here to see photos of some of the deadliest tunnel disasters.

The Department of Homeland Security quietly tested an inflatable airbag in the D.C. Metro in August that could save lives and change the way we respond to fires and flooding down below.

Click here for exclusive footage of the tunnel plug tests in the D.C. Metro.

"It will be very difficult to achieve a solution to the challenges posed by each threat," said John Fortune, program manager for the Infrastructure and Geophysical Division at the Department of Homeland Security. "Water is heavy, fire is hot, [chemical and biological agents] can disperse easily."

His team wants to stop all three, and it believes an über-airbag could do the trick.

Here's how it works:

Sensors embedded along tunnel walls would detect breaches and deploy rapidly inflating airbags. In an ideal situation, the inflammable airbags would stop up flood waters or hem in fires, allowing passengers to escape cars and trains in good time.

In testing, it took the bag about three minutes to reach the size of the tunnel and adjust to the "nuances" of its shape, Fortune said. "With a high powered fan," he said, "it can inflate in less than one minute."

While the prototype may not yet be the fastest moving airbag in the West, DHS now has proof that the concept is workable.

Planners hope the plug could avert disasters like the 1999 fire in the Mont Blanc Tunnel, which connects Italy and France. A truck carrying margarine and flour caught fire and filled the entire tunnel with noxious smoke in 10 minutes, burning wildly for 50 hours and killing 39 people.

A similar disaster occurred outside Los Angeles last October when a 35-car pileup inside a highway tunnel created a fire that could not be contained for days. And smoke chased survivors of the July 2005 Underground bombing in London as they tried to escape from the blast.

Fortune thinks properly deployed plugs could seal off oxygen in a hot zone, cutting off fuel for the fire, and could keep smoke from spreading to other areas of subway tunnels.

The plug could also help isolate and slow the spread of biochemical agents. In 1995, the Aum Shinrikyo cult released sarin gas in five Tokyo subway cars, killing 12 and injuring thousands.

A tunnel plug could prevent the airstreams in a subway system from becoming weaponized, which would stop other trains, tunnels, and platforms — and thousands of people — from becoming prey to poison.

Scientists have been considering the plug for more than a decade. Before the Chunnel between England and France was launched in 1994, many worried that a train or truck laden with explosives could be set off in the world's largest undersea tunnel. And just two years later, a massive fire burned for 14 hours there beneath the British Channel.

While the original idea for a tunnel plug was the result of Chunnel brainstorming, it was never successfully implemented on the other side of the pond.

But security architects in the U.S. at Homeland Security weren't willing to put the idea to bed, so scientists formed a transatlantic partnership involving West Virginia University and UK-based Lindstrand Technologies to move the concept from the drawing-board and into practice.

The plug is still only in the early stages of development and developers face a big problem: Could it seal survivors inside a disaster zone?

Homeland Security still has to navigate the moral minefield of "acceptable casualties" that could occur while trying to save a greater number of victims from attack. An impassable airbag could close toxins in or prevent passengers from escaping deadly flames.

Fortune believes human control could prevent such problems when the plug is being deployed. "It is reasonable to assume there will be some operator involvement so we don’t have to trap people," he said.

Fortune's team is working on finding an answer to that million dollar question before the next deadly disaster, natural or man-made, can strike.