Most shoppers crouched behind checkout counters or bolted toward the back exit. But as a gunman fired inside a Wal-Mart store in a Denver suburb, some patrons took a more defensive approach: They grabbed their own guns.

They were the proverbial “good guys with guns” that gun rights advocates say have the power to stop mass shootings.

But police in Thornton, Colo., said that in this case the well-intentioned gun carriers set the stage for chaos, stalling efforts to capture the suspect in the Wednesday night shooting that killed three people.

None of the armed civilians fired their weapons, and the suspect managed to flee the store.

Police began combing through store security camera footage to identify him and determine whether he had an accomplice.

“Once the building was safe…. we started reviewing that [surveillance video] as quickly as we could,” Victor Avila, a spokesman for the Thornton Police Department, told reporters.

But the videos showed several people in the store with their guns drawn. That forced detectives to watch more video, following the armed shoppers throughout the store in an effort to distinguish the good guys from the bad guy, Avila said.

Investigators went “back to ground zero” several times as they struggled to pinpoint the suspect, he said.

Five hours after the shooting, police identified 47-year-old Scott Ostrem as the gunman. He was arrested Thursday morning.

The assessment by police that armed civilians hampered their investigation is being embraced by gun control advocates, who argue that more guns on the scene of a shooting add up to more problems.

“Especially civilians with weapons — it does nothing but possibly cause more chaos and harm,” said Tom Sullivan, who became a gun control advocate after his 27-year-old son, Alex, was killed along with 11 other people by a gunman who opened fire inside a movie theater in Aurora, Colo., in 2012.

Sullivan says he resents any suggestion that those deaths could have been prevented if more moviegoers had been armed.

On the other side of the debate, Dudley Brown, president of the National Assn. for Gun Rights, says the conclusions by police in the Wal-Mart shooting are misguided.

“This is a part of the job of police — to investigate what happened, not highlight that patrons were legally armed,” he said. “In that situation, what are people supposed to do? Lay down on the floor and draw chalk marks around themselves?

“I’d rather be armed with a gun and not need it, than to be not armed and be in a situation where one is needed,” he said.

The National Rifle Assn. did not immediately respond to a request for comment.

Gun rights advocates point to cases such as that of a Chicago Uber driver who in 2015 shot and wounded a gunman who opened fire on a crowd.

But studies suggest such cases are rare.

In a 2014 FBI report, researchers examining more than 100 shootings between 2000 and 2012 found that civilians stopped about 1 in 6 active shooters — usually by tackling the gunman, not shooting him.

Maria Haberfeld, a professorof police science at the John Jay College of Criminal Justice in New York, said using a gun for self-defense should be a last resort.

“If their life is in immediate danger and they cannot run or hide, then they can move into the fighting mode and use their weapons,” she said.

Bystanders shouldn’t pull their weapons unless they’re members of law enforcement, or used to be, she said, because without training they can’t properly assess the situation and could end up causing more deaths.

kurtis.lee@latimes.com