Two men were busted for allegedly trying to carjack an off-duty New York City police officer – triggering a wild gun fight with cops Tuesday in Queens, officials said.

Chad Collie, 19, and Jayare Robinson, 18, were arraigned Thursday in Queens Criminal Court on first-degree attempted murder and other charges after the attempted car heist that left an officer wounded.

Commissioner Keechant Sewell gives presser after officer shot Feb. 1

NYPD Commissioner Keechant Sewell and Mayor Eric Adams give a press conference Feb. 1 at Jamaica Hospital after an officer was shot in the shoulder during at attempted carjacking. The victim was the sixth officer shot in the city this year. (NYPD)

"This was a brazen carjacking attempt that all too easily could have ended in yet another tragedy for NYPD and all New Yorkers," said Queens District Attorney Melinda Katz in a statement. "This blatant disregard for human life must be answered with certain justice."

Six New York City police officers have been shot so far this year – including detectives Jason Rivera and Wilbert Mora who died from their injuries.

IN GUT-WRENCHING EULOGY, JASON RIVERA'S WIDOW SAYS SHE STILL HAS HER HUSBAND'S BACK

The latest shooting occurred at about 10 p.m. when the defendants approached the off-duty police officer who was on his way to work. He was stopped at a red light when the men tapped on the driver's side window and ordered him to get out. The 22-year-old cop exited his vehicle as the suspects boxed him in on both sides, officials said.

Jason Rivera and Wilbert Mora were murdered in New York City after responding to domestic violence call

NYPD detectives Jason Rivera and Wilbert Mora were murdered last month after responding to a domestic violence call.

The cop tried to get away, but Collie allegedly squeezed off three shots, striking him once in the shoulder, according to the DA. The officer returned fire but missed as the suspects fled on foot.

Nearby uniformed police officers in an unmarked car heard the gunfire and pursued the defendants, according to prosecutors.

DOWNLOAD THE FOX NEWS APP HERE

Collie allegedly opened fire, hitting the rear of the unmarked police car, before tossing the weapon in a patch of grass and bolting. The cops, who weren't hit, caught up to the suspects and took them into custody.

Both defendants face up to 25 years in prison if convicted.