A 19-year-old man was charged with attempted murder for allegedly firing a gun next to a police officer’s head during a struggle Tuesday night in the city’s Kingsessing section, District Attorney Larry Krasner announced Wednesday.

Devon Smith was in custody and prosecutors were recommending that he be held on $2 million bail, Krasner said.

About 10:40 p.m., two 12th District officers responded to the 1200 block of South 56th Street for a reported domestic incident involving a gun. Police said the officers encountered Smith on the porch of a residence and asked him about the location of the gun.

As an officer grabbed his hands, Smith allegedly moved away and fired a gun above the officer’s head. The officers were able to subdue Smith and take possession of the gun, police said.

One of the officers suffered powder burns to the side of his face and temporary hearing loss, police said. He was taken to Penn Presbyterian Medical Center and was listed in stable condition. The other officer was not hurt.

The District Attorney’s Office said in a news release that Smith allegedly had both his hands in his pockets and indicated he had a gun in one pocket. “As one officer approached and attempted to apprehend Smith, Smith is alleged to have fired a gunshot, missing the officer but causing gunpowder burns to his face, for which he was later treated,” according to the news release.

Smith also was charged with aggravated assault on police and related offenses. The names of the officers were not released.

“We are grateful that these officers emerged from this dangerous incident alive and largely uninjured. The allegations against this defendant are serious, and he will be held accountable by my office and the courts,” Krasner said in a statement.

“Anyone who would fire a shot at a police officer is someone who has no business owning a gun. Our officers should not have to contend with a city and nation that has more guns than people. I once again call on local and national leaders to keep all of our communities safe by stringently restricting the manufacture and commerce of deadly firearms,” Krasner said.