Prosecutors investigating a fatal shooting involving a New Jersey state police detective in Moonachie on Wednesday said the civilian who died had approached an undercover officer working in the area before being shot.

The New Jersey attorney general's office on Thursday identified the deceased as Roberto Castro-Quinonez, 30, of Bakersfield, California.

The identity of the officer involved in the fatal shooting has not been released.

According to preliminary information, at approximately 5:15 p.m., New Jersey state police detectives were conducting an investigation on Gotham Parkway, near the intersection with West Commercial Avenue. The detectives, operating in plain-clothes, were in the area as part of a criminal investigation, according to prosecutors.

While in that area, one of the detectives was approached by Castro-Quinonez. An interaction between the two men ensued, and a second detective arrived at the scene to assist, prosecutors said.

Shortly thereafter, one New Jersey state police detective discharged his weapon two times, striking Castro-Quinonez, officials said.

Officers attempted to perform medical aid, but Castro-Quinonez was pronounced deceased at 5:44 p.m., according to prosecutors.

The attorney general is required by law to investigate a person's death that occurs during an encounter with a law enforcement official.

This is a developing story and may be updated.