One of the men apparently tried to shoot at the officer but his gun jammed, the prosecutor's office said.
The officer shot both men -- identified as Dante Holden, 19, of and Tymyr Wilson, 21, both of East Orange -- and both were pronounced dead at the scene, Laurino said.
Officials declined to identify the officer involved.
A spokeswoman for Jersey City Monday issued a statement on the incident.
"We are thankful that our detective, who was a victim of an attempted armed robbery, is OK and want to thank the Newark Police Department and the Essex County Prosecutor for their assistance in this ongoing investigation," said city spokeswoman Jennifer Morrill.
She declined to answer any additional questions about the officer.
In keeping with Attorney General guidelines, details of the investigation into the incident will be presented to an Essex County grand jury. By Jessica Mazzola [email protected],
NJ Advance Media for NJ.com