A Baltimore police officer shot and critically wounded a man who was reportedly looking to ambush the officer in an attempted “suicide by cop.”

The officer “perceived he was being ambushed,” said Baltimore Police Commissioner Kevin Davis. “Which is a really scary thing in police work, and it’s not the first time an American police officer in the last year or so has been ambushed.”

Investigators said the officer was sitting in his patrol car at 9:30 a.m. when he noticed a man pointing a 9mm handgun at him. The officer fired through the driver-side window, hitting the suspect several times.

“The suspect was conscious and alert when he was transported to the hospital,” said Baltimore police spokesman T.J. Smith. “What we understand is his condition is listed as critical at this time.”

The Baltimore police posted a live broadcast to its Twitter account, which shows footage of the crime scene and a statement to the press by Baltimore Police Commissioner Kevin Davis and police spokesman T.J. Smith.

“The fact that the weapon was not loaded doesn’t change the threat that was perceived by the officer who had a raised gun at him while he was sitting in his patrol car,” said police spokesman T.J. Smith.

“The fact that someone would approach a uniform police officer sitting in his marked patrol car on a Sunday morning and raised a firearm at him and the fact that the firearm, now we known wasn’t loaded, indicates to us that it was a suicide by cop,” said police commissioner Davis.

“I’m just in shock that someone would have a gun and do that, and early on a Sunday morning,” said City Councilwoman Sharon Green Middleton, who represents the Park Heights community where the shooting occurred.

“It’s another example of the problems we have with guns and how easy it is to obtain a gun on the street. I continue to pray for our officers that put their jobs on the line every day, and I pray for the family of this person that did this particular act.”

The officer, whose name has not been released, was not injured in the shooting.

Follow Jerome Hudson on Twitter: @jeromeehudson