THE ROOM WAS a rectangle of cinder block walls and dark carpet, interrupted every few feet by weight benches and bulky exercise equipment.

The gunman, a lanky figure covered from head to toe in black, had the drop on two SWAT Unit cops who had chased him down a hallway, past two bodies, into this claustrophobic space.

He hunched his shoulders and aimed his weapon, an M4 carbine rifle.

"Down! Down!" a cop bellowed.

Two shots rang out like claps of thunder. The gunman crumpled to the ground.

He popped up a few moments later - sporting splotches of red paint on his face mask.

The tense showdown was just part of an elaborate drill staged yesterday by Philly cops, firefighters and medics as they ran through their training for active-shooter incidents.

For several years, the Police Department has been reinventing how it and other agencies would respond to a worst-case scenario - a shooter loaded for war opening fire on civilians in an office, a school, a movie theater, a mall.

A generation ago, said police Chief Inspector Joseph Sullivan, the plan of action would have been simple: Patrol cops would arrive at the shooting scene, set up some crime-scene tape, and wait for SWAT to show up.

But that strategy was rendered obsolete by nightmares like those that unfolded in Newtown, Conn., Aurora, Colo., and Tucson, Ariz.

So the Police Department has trained about 4,000 patrol cops and 220 medics on how to respond rapidly to situations like the Columbine High School massacre, Sullivan said. The training has been extended to SEPTA police and Sheriff's Office deputies.

"We all follow the same curriculum," Sullivan said, "so we can all operate as a single unit."

The first four patrol officers to arrive at an active-shooter incident would act as the contact team, moving in formation into a building quickly to track down and stop the gunman, as they did during yesterday's drill at SWAT's headquarters at the Police Academy in Northeast Philadelphia.

A second team of cops would follow, providing cover for medics who could tend to victims. More would follow as needed.

"The faster you can get to somebody who's been wounded, you increase their survival odds dramatically," said Fire Paramedic Capt. Chris Baldini.

The goal, he said, is to reach victims within 10 to 15 minutes of a shooting.

Every police officer in the city now carries tourniquets, which could prove lifesaving to someone who's been shot in the arm or leg, Baldini said.

Training sessions have been held in the Comcast Center, in Philadelphia International Airport and in empty school buildings, Sullivan said. Another will take place at the National Constitution Center.

"It really hits home. I have two little kids who are just starting school," said SWAT Officer Joseph Iacuzio, who portrayed a gunshot victim yesterday.

"I always tell the other officers, you never know what could happen. You could end up having to go into your kid's school or your family member's office."

On Twitter: @dgambacorta