An on-duty police officer happened to walk in on an armed robbery at a Newark, N.J. gas station and stopped the theft by shooting one of the suspects and arresting the other, authorities said.

The incident occurred at around 12:30 a.m. Thursday at a Sunoco located at 378-392 Washington St., according to PIX 11.

There were two men involved in the attempted robbery, police report. One suspect, who was armed, entered the gas station and took money from one of the clerks, while the other acted as a lookout. 

A Newark police officer happened to come in the store while the robbery was in progress, reported ABC 7. The lookout was arrested, while the armed suspect was shot in the chest after refusing to surrender.

The suspect who was shot was taken to University Hospital, where he is listed in serious but stable condition, while the other man was taken into custody.

An investigation into the shooting by the prosecutor's office is underway, said Chief assistant Essex County prosecutor Thomas Fennelly, according to True Jersey.

A clerk who works at the gas station reports that the last time the station was robbed, the attackers were wearing masks, so it's unclear if Thursday's would-be thieves were the same as those back then.

The officer was uninjured in the incident. His name, along with the names of the two suspects, have yet to be released.