A Philadelphia police officer was shot in a thigh Wednesday morning when he and his partner "interrupted a shooting" in Kensington and got into a gun battle with at least one of the suspects, Police Commissioner Richard Ross said.

Officer Paul Sulock, 31, was in stable condition and in good spirits at Temple University Hospital with a right thigh wound, Ross said. Two men were taken into custody. Their names were not immediately released.

Ross said the gun battle unfolded about 11 a.m. when Sulock and his partner saw two men crouched behind cars in the apparent prelude to a shooting at G and Madison Streets.

The officers tried to stop the men, one of whom fired at the cops, hitting Sulock — an 11-year veteran of the force and a father of four whose own father is a police officer, Ross said.

The officers returned fire and, although wounded, Sulock chased down one of the suspects, Ross said. Police later caught the second suspect after heavily armed officers searched the area.

Ross said it was not known whether both men were armed when the officers saw them crouching. Neither was hit by police gunfire.

"There's no doubt they interrupted a shooting," Ross said of Sulock and his partner. "They probably saved the life of the guy who shot him."

"It unfolded in a matter of seconds," he said.

Police radio captured Sulock telling dispatchers, "I'm shot," and "I'm shot in the leg," as officers quickly began responding to the scene.

Ross noted that he had spoken to Sulock in the neighborhood minutes before the shooting.

Both Mayor Kenney and District Attorney Larry Krasner joined Ross at the hospital and praised Sulock for his bravery and quick action.

The Fraternal Order of Police Lodge 5 issued a statement saying Sulock was "expected to make a full recovery."