Mayor Martin J. Walsh said he’s “concerned” and wants to talk to the administrators of a community center who barred police from coming to the aid of an officer who was being attacked inside.

“Any time that the police are trying to do their job, no one should stand in their way. Let them do their job,” Walsh told the Herald yesterday. “I don’t want to see a police officer get hurt doing their job and protecting other young people.”

Newly sworn-in Commissioner William G. Gross wouldn’t comment yesterday, except to say, “that situation is handled.”

Thursday, police said, two undercover officers followed a teen suspect and another youth into the Dewitt Center in Roxbury. As one officer grabbed one teen, the other found himself under assault.

But backup officers were prevented from coming in, and had to watch the beating through the glass doors, police said.

Madison Park Development Corp., which operates the Roxbury center, in a statement released to the Herald yesterday, said, “We regret that one officer received a minor injury in the incident.”

The nonprofit organization, which develops affordable housing, said it is currently “reviewing” its safety protocols and said it has a “long history of working cooperatively” with the Boston Police Department.

Madison Park and Dewitt officials refused requests for interviews on the incident.

The two undercover officers were following a 15-year-old, with a search warrant related to a gun investigation. He and another teen with him fled into a classroom at the community center.

Police said the pair began pushing and physically assaulting the officers. One officer detained the juvenile they had a warrant for, but the other, a 16-year-old, bolted toward the stairwell leading to the first-floor exit.

The other officer tackled him and they ended up tumbling down the stairs. The teenager was kicking the cop in the face and upper body repeatedly, police said.

That’s when backup officers arrived and were barred from entering, police said. They eventually got inside, where they helped subdue the 16-year-old and said they found a loaded .22-caliber revolver in his backpack.

Police said the front desk worker was afraid of getting in trouble with her boss, after she already had been reprimanded for letting the two undercover officers in before them.

The Madison Park statement said, “We are currently reviewing our security protocols, particularly in a situation when undercover officers attempt to enter the building.”

Two officers were transported to a local hospital with non-life-threatening injuries. Both juveniles had been on bail on gun and robbery charges, according to the Suffolk District Attorney’s Office, and their bail was revoked.