A police officer stands guard while rescue workers and firefighters search through rubble following a building collapse in Philadelphia, June 5, 2013. Reuters

Within the past 24 hours, one police officer in Boston and another in Philadelphia were shot and hospitalized in their respective cities, multiple news outlets reported. Police officials said during a press conference Friday that the suspect in the Philadelphia shooting, Edward Archer, pledged allegiance to the Islamic State group, also known as ISIS.

The Philadelphia police officer, Jesse Hartnett, who was hit three times Thursday night in a 13-bullet ambush, was in stable condition as of late Friday morning, the Wall Street Journal reported. After being shot, Hartnett managed to open fire on Archer, hitting him in the buttocks.

Archer, who had not been charged as of early Friday afternoon, was arrested by police Thursday night. Neither Hartnett nor the suspect suffered life-threatening injuries, although Hartnett is expected to undergo multiple surgeries, according to Philadelphia Police Commissioner Richard Ross Jr.

While the suspect said he acted in the name of Islam, Philadelphia Mayor Jim Kenney said during the press conference that the suspect is just a criminal and does not represent the teachings of Islam.

In Boston Friday morning, an officer was taken to the hospital after being shot in the leg in the Dorchester neighborhood. The injury wasn’t considered life-threatening, ABC News reported. Police said Friday they had arrested a suspect. Local media reported the attack was unprovoked.

The unidentified Boston officer was a nine-year veteran of the Boston police drug unit, Boston Police Department Commissioner William Evans said at a news conference Friday, according to local WFXT-TV. The shooting suspect, 27-year-old Grant Headley, is well-known to Boston police, having been locked up before on firearms charges.

“He is out on probation, and he is out selling drugs, and that’s why he was pulled over,’’ Evans said, according to the Boston Globe.

After pulling him over, police officers reportedly surrounded the car, boxing Headley in. The officers did not take out their weapons while boxing in the car, but Headley eventually got out of the vehicle and starting shooting unprovoked, the Globe reported.

After the shooting, both Evans and Pat Rose, president of the Boston Police Patrolmen's Association, said there are far too many guns on the streets.

In the Philadelphia shooting, police described the incident as an attempted execution, the Washington Post reported. “It’s amazing he’s alive,” Ross said, referring to Hartnett, the Post reported. “We’re just lucky, that’s all I can say. I can’t even believe he was able to survive this.”