An armed robbery suspect shot a police officer, a homeowner and then himself Tuesday night in North Philadelphia, investigators said.

The incident began after 10 p.m. when a 26th District officer responded to a reported armed robbery, NBC Philadelphia reports.

While speaking to the victim, the officer spotted a man who matched the description of the suspect. As the officer approached him, the suspect pulled out a gun and opened fire, police said. The officer was shot twice in the shoulder and the suspect fled the scene, according to investigators.

The fleeing suspect ended up in the back of a residential property. When the homeowner waved down police, the suspect fired his gun again, police said. The homeowner was shot once in the thigh.

The responding officers chased after the suspect, who fled down an alley. The suspect then shot himself in the head, police said.

The officer and homeowner who were shot and the injured suspect were all taken to the hospital and listed in stable condition and expected to survive.