A police officer was shot in the leg Monday night during a traffic stop in North Philadelphia when a gun discharged during a pat-down, officials said.

The officer, 53, whose name police did not release, was taken to Temple University Hospital.

“He’s doing extremely well,” Police Commissioner Kevin Bethel said.

Officers assigned to Highway Patrol 10 were responding to reports of gunfire when they stopped a red four-door Saab on the 1700 block of Cumberland Street, police said.

The driver and a passenger were asked to step out of the car, Bethel said, and as an officer frisked one of the men, the man’s firearm discharged, striking the officer in the leg.

Speaking outside the hospital alongside Mayor Cherelle L. Parker on Monday night, Bethel said the officer was alert and in good spirits. The mayor had visited him and “had him smiling,” the commissioner said.

The officer is married with three children, Bethel added, and is expected to recover. “His prognosis looks good,” he said.

Police continue to investigate the shooting. Bethel said investigators still had “a lot of work to do” to determine what happened.

A police spokesperson did not immediately respond to a request for additional information Tuesday.