PORTLAND — Pairs of Portland police officers charged through smoke and the sound of screams, looking for a fictional gunman who had opened fire on civilians – all part of training in case the real thing happens here.

The department finished three months of what it calls “active shooter training” at the Portland Ocean Terminal this week. The series of exercises were aimed at familiarizing officers with what they need to do in the chaos of a real shooting scenario.

“If this happens down the road, they’ll at least have muscle memory,” said Portland Police Chief Michael Sauschuck, referring to the tendency for training to take over in high-stress situations.

The drills were funded through a federal Homeland Security grant administered by the Maine Emergency Management Agency. In the first phase, six Portland officers traveled to Louisiana State University to get the latest in tactical training and learn how to train others.

They then brought that knowledge back to Portland so that every officer in the department could undergo training.

Sauschuck said the need for every officer o be trained reflects changes in how police respond to situations where a gunman is shooting people. Police practice used to be that the first officers to arrive would block off a perimeter and wait for specialists, such as a special reaction team.

Then, after the Columbine High School massacre in Colorado in 1999, police realized it was more important to get officers into the building quickly. Now, the first two officers on the scene are supposed to enter the building – or wherever the shooting is occurring – and try to address the threat, Sauschuck said.

Training on Tuesday featured officers wearing black protective hoods with visors who first smashed through a locked metal door and cut a chain to get through. That exercise was drawn specifically from the 2007 Virginia Tech shooting rampage, in which the gunman used chains to lock the exterior doors of a building, Sauschuck said.

Officers then charged upstairs where an instructor screamed that there were people being shot down the hall. A smoke machine made it hard to see and an audio track played the loud reports of simulated gunfire and blood-curdling screams.

When officers identified a suspect, they fired an artificial ammunition that, like paintballs, left a mark. Instructors could then critique not only the response but the shooting decisions and accuracy under stress.

The training for each of the 150 officers consisted of five hours in the classroom and 10 hours of training exercises.

Sauschuck said officers will train for such situations, but civilians should also know what to do: run, hide, fight.

If someone is shooting, people should run if they can. If not, find a safe place to hide if that is possible, locking doors and turning cell phone ringers off.

If they can’t run or hide, or they’re discovered, “you fight for your life,” Sauschuck said.