“When threatened, the officer fired,” said Daniel Linskey, superintendent in chief of the Boston Police Department.

Nobody appeared to have been wounded in the close-range shootout, which stunned residents and brought the area to a standstill.

Investigators said they were trying to piece together details of the 3 p.m. shooting at ­Warren and Waverly streets. By Tuesday evening, police had charged one man and were questioning two others, but said many facts remained ­unclear.

Authorities said it appeared that the initial confrontation ­involved a group of four men against one person, but another group became involved and ­also opened fire.

“We don’t know if they were rival gangs or whether they were working together” to shoot the individual, Linskey said. Investigators were searching for the second group of men, who had fled.

It was not clear whether any of the men fired at the two respond­ing officers, who were on patrol when they came upon the shooting.

“It was a harrowing scene,” said Linskey, adding that the ­officers, part of a youth violence strike force, averted more violence by intervening so quickly.

Police caught a suspect a couple of blocks away and took him in for questioning. Police said they will probably charge the man, along with two other suspects, in the incident. The first man had a hand injury, but it was not a gunshot wound, ­police said.

Some of the shooting was captured by a surveillance camera, authorities said, and one handgun was found near the scene.

Kenny Roberts, who lives just up the street, was at home when he heard two gunshots, then a hail of gunfire in ­response.

He rushed downstairs to see a woman in the front hall, screaming “Help me! Help me!” He later learned she had come to the building to inquire about renting an apartment.

As Roberts ran out onto the sidewalk, he saw a police officer leap from his cruiser and chase a man down the street. As he ran, the suspect threw his gun in the street.

Roberts, 31, said another group of men did not initially appear to be involved, but ­began firing after the shooting began.

“The police were sandwiched in between gunfire,” Roberts said.

Roberts said the neighborhood had seen violence before, but not on this scale.

“Nothing like this, in broad daylight,” he said.

Ceses Ribera, who owns a market at the intersection, said he heard multiple gunshots. One customer was in the store at the time, but he left quickly.

“They closed everything off,” he said by phone. “I have not been able to leave for two hours.”

With area streets cordoned off, many residents were unable to get home, including some children on their way from school. Many were unnerved by the scene.

“There’s yellow tape everywhere,” one teenage girl said by phone to her mother, tears running down her cheek.

Up the street, a group of teenage boys watched the ­police process the scene. They did not know what happened, and asked whether anyone had been killed. Told no, they sighed with relief.

“No one dead,” one said. “That’s a good thing.”

Globe correspondent Haven Orecchio-Egresitz contributed to this report. Peter Schworm can be reached at schworm@­globe.com. Follow him on Twitter @globepete.