A suspect believed to have shot an off-duty police officer in the head was in custody, police officials said Tuesday.

The suspect, Randy Jones, 38, was tracked down Monday at a Days Inn in Rockland County, according to NYPD Commissioner Keechant Sewell.

Sewell said that Jones was hiding out with his girlfriend and five children.

Charges were pending Tuesday morning while authorities waited for the results of a search warrant, according to Chief of Detectives James Essig.

The wounded police officer, identified by police officials as Adeed Fayaz, a 26-year-old father of two, remained in critical condition in the hospital.

“[He] is in grave condition and is fighting for his life at this moment,” Sewell said.

The shooting took place Saturday night at around 7 p.m. on Ruby Street in East New York, in a subsection of the neighborhood known as “the Hole.”

The officer and his brother-in-law were attempting to buy a $24,000 Honda Pilot advertised on Facebook Marketplace.

Randy Jones asked if the two men had a gun, then pulled Fayaz into a headlock, pointing a gun at his head and demanding cash, according to Essig.

The off-duty officer wriggled free, but Jones opened fire, striking Fayaz in the head. The brother-in-law grabbed Fayaz's gun and fired at the man, who jumped into a black car and sped off.

Essig said police used surveillance camera footage to track the car’s movements, eventually determining it was parked in a DSNY parking lot at 130th Street and Park Avenue in Harlem.

There, they found the car had TLC plates registered to a woman whose son, Jones, matched the description of the East New York shooter.

Video footage showed the same man in an orange sweatshirt leaving the car, then exiting from an apartment building nearby with a woman and five young children. The seven were later tracked down at the Rockland County hotel.

Essig said police used Officer Fayaz’ handcuffs to bring Jones in.

“We wanted him to know what he did to that officer,” Essig said. “I think it sends a powerful message.”

Essig said they were looking into several similar Facebook Marketplace heists that had taken place in recent months, including one that took place on the same street as the Saturday shooting, to see if there was any connection.

Information about Jones’ attorney wasn’t available right away.

This story has been updated with additional details.