PHILADELPHIA (AP) — A man was shot by a police officer after attacking officers with a screwdriver in a police station in north Philadelphia, police said.

Police said the man, who was wearing a mask, entered the lobby of the 39th police district building in the Nicetown-Tioga section of the city at about 9:20 a.m. Wednesday.

Sgt. Eric Gripp said the man came to the operations room window, but officers were unable to hear him through the plexiglass divider. An officer opened a side door, and the man then “lunged into the operations room right at the officer.”

The man, armed with a screwdriver, began fighting with one officer, and that officer and another officer tried to disarm him as he was “swinging the screwdriver in their direction,” Gripp said.

Gripp said one officer fired at least one shot, striking the man in the torso. The 23-year-old suspect was taken to Temple University Hospital in critical condition. One officer had wounds to the back of his head and another officer had an elbow injury, Gripp said.

“We’re very lucky this wasn’t worse than it was,” Gripp told reporters.

Get the latest local news, weather, and community events. Sign up for the WTAJ Newsletter.

The officer-involved shooting investigation unit will investigate the shooting.