The career criminal accused of fatally shooting a New York Police Department officer in the stomach during a routine traffic stop pleaded not guilty at his arraignment Tuesday morning, more than a month after the incident.

Guy Rivera, 34, was hospitalized after he allegedly inflicted a mortal wound on Officer Jonathan Diller, 31, and fellow officers returned fire. He was still wearing a brace on his wrist when he arrived handcuffed in court and had visible scars on his face. He had a buzzed head and goatee and was wearing a white dress shirt and pink tie.

Prosecutors told Judge Michael Aloise that Rivera admitted to police at the hospital that he had a shank hidden within his body. They also asked the judge to remove legal aid counsel from the defense, alleging a conflict of interest involving potential witnesses in the case who had also been represented by legal aid in matters that were sealed by the court.

Prosecutors also notified Judge Aloise that they would seek a sentence for Rivera under the state's "persistent felony offender" rules due to his extensive criminal history if convicted.

NYPD JONATHAN DILLER SHOOTING: SUSPECT GUY RIVERA CHARGED WITH MURDER, ATTEMPTED MURDER IN ATTACK ON OFFICERS

Guy Rivera enters court

Murder suspect and ex-con Guy Rivera appears for his arraignment in a Queens, New York, courtroom on Tuesday, May 7. Rivera is charged with the murder of NYPD Officer Jonathan Diller and attempted murder of his partner, Sgt. Sasha Rosen. (Fox News)

On March 25, a group of NYPD officers including Diller approached Rivera and his friend Lindy Jones, another ex-con, in an illegally parked car in Far Rockaway, New York

The officers suspected he might have been carrying an illegal handgun after witnessing him walk out of a store with a gun-shaped object in his front pocket, prosecutors revealed Tuesday.

Rivera allegedly refused the officers' request to open the car window and instead pulled the gun, shot Diller beneath his vest and took aim at NYPD Sgt. Sasha Rosen.

The two wrestled for control of the gun, and it jammed when Rivera allegedly squeezed the trigger again.

JONATHAN DILLER SHOOTING: NYPD SERGEANTS' UNION TELLS ANTI-POLICE DEMOCRATS TO STAY AWAY FROM FUNERAL

Officer Diller in NYPD uniform on scene

NYPD Officer Jonathan Diller is survived by his wife and their nearly 1-year-old son. (NYPD)

Rivera suffered a gunshot wound of his own during the struggle and was taken to the hospital.

Police recovered another gun from Jones' glove box, with the serial number scratched off, prosecutors said. He faces felony firearms charges.

Both men have lengthy rap sheets and prior felony convictions. One has pending felony charges, and both obtained firearms they could not legally own.

NYPD OFFICER SHOT, KILLED DURING CAR STOP IN QUEENS BY SUSPECT WITH MULTIPLE PRIOR ARRESTS: POLICE

Guy Rivera in court

Murder suspect and ex-con Guy Rivera appears for his arraignment in a Queens, New York, courtroom on Tuesday, May 7. Rivera is charged with the murder of NYPD Officer Jonathan Diller and attempted murder of his partner, Sgt. Sasha Rosen. (Fox News)

Rivera has had 21 prior arrests, nine of them for felonies, and he recently got off parole.

Queens District Attorney Melinda Katz previously said Rivera's arraignment would happen as soon as he was medically cleared.

"We are grateful that the grand jury returned serious charges against the defendant," she said Tuesday. "Our thoughts are with Detective Diller’s family, friends and colleagues as they continue to grieve. We will seek justice for him."

Jones, 41, was convicted of attempted murder in 2002, served time in prison and was somehow out on the streets despite a pending felony firearms case from last year, according to the Queens District Attorney's Office.

Ex-con Lindy Jones appears in a Queens courtroom following the shooting death of NYPD Officer Jonathan Diller

Ex-con Lindy Jones appears in a Queens, New York, courtroom following the shooting death of NYPD Officer Jonathan Diller. A passenger in Jones' car, Guy Rivera, is accused of opening fire on the officer during a traffic stop. (Pool via Richard Harbus for Daily Mail)

CLICK HERE TO GET THE FOX NEWS APP

Diller died at Jamaica Hospital in Queens.

He had a wife and a 1-year-old son.

News of his death prompted a national outcry that grew larger after details about the suspects' criminal backgrounds emerged.

Jonathan Diller smiling

NYPD Officer Jonathan Diller, 31, was the father of a 1-year-old boy. A violent ex-con has been accused of fatally shooting him during a stop. (Tunnel to Towers Foundation)

"Detective Diller was shot and killed while trying to rid our streets of illegal weapons, a lawless act that was an affront to a civilized society," Katz said in a statement Tuesday. 

Former President Trump attended his wake on Long Island as President Biden hosted wealthy donors for a fundraising gala in nearby Manhattan.

Guy Rivera poses for mugshot in white T-shirt and black hat, with a beard and mustache

Guy Rivera, an ex-con suspected of fatally shooting NYPD Officer Jonathan Diller, appears in a mugshot. (NYPD)

Rivera is being held without bail. He could face up to life in prison without the possibility of parole if convicted. The judge set his next hearing for July 22.

Jones faces up to 30 years in prison on the gun charge. He returns to court on June 12.

Fox News' Julia Bonavita contributed to this report.