QUEENS — An off-duty NYPD officer is recovering in the hospital after being shot Tuesday night during a robbery attempt in Queens, police say.

According to the NYPD, the shooting happened just after 10 p.m. at Beach Channel Drive and Beach 62nd St. in Arverne.

Police say the 22-year-old officer was heading into work when two men approached him as he sat in his car at a traffic light and tapped on his window with a gun.

Police say when the officer stepped out of his vehicle one of two robbers fired multiple shots, hitting the officer in shoulder.

The off-duty officer then returned fire but did not strike the two robbers as they ran away.

According to police, officers from the nearby 100th precinct heard the shots and responded to the scene, rendering help to the off-duty officer.

Police say uniformed officers in an unmarked vehicle found the robbers a few blocks away. At that point, police say one of the robbers fired at the officers, hitting the bumper of the police vehicle.

The officers did not return fire, according to police.

Investigators say the robbers were arrested with no further incident and a gun was recovered.

Charges are pending.

The injured off-duty officer was transported to Jamaica Hospital and underwent surgery. He is expected to be okay.

At a press briefing at the hospital, Mayor Eric Adams said officers displayed a "great level of restraint" given the circumstances.

"When these two individuals shot at a passenger driving a car, they didn't shoot at a police officer, they shot at a civilian. Then to find out they shot at police officers, it sent a message, they had no regard of who they were trying to kill," Adams said.

The incident comes as the department prepares to lay to rest NYPD Officer Wilbert Mora at Saint Patrick's Cathedral Wednesday.

According to NYPD crime statistics, shooting incidents for the week of January 24-30 stands at 21. For the same week last year it was 12, a 75% increase.

The Queens officer injured Tuesday night is the sixth NYPD officer to be shot this year and is the second to be off-duty when it occurred.