The suspect in a string of cellphone robberies turned the tables on a quartet of Brooklyn cops who tried to take him into custody — getting hold of one of their Tasers and shocking at least two of the officers, according to police and surveillance footage.

Video obtained by The Post shows the police officers rush to try to detain a combative, long-haired man around 6:15 p.m. Sunday after recognizing him from wanted posters regarding a robbery pattern that had occurred throughout Brooklyn subway stations, cops said.

Wearing an orange shirt and gray sweatpants, the suspect exits a deli on Nostrand Avenue in Prospect-Lefferts Gardens swinging his arms at waiting police officers, video shows.

One of the cops immediately takes out his yellow Taser as the four uniformed officers scuffle with the man, who continues to put up a fight.

Eventually, two of the officers take out their batons and whack the suspect.

But the man continues to throw punches, and grabs a cop’s Taser — stunning at least two of them and running away with the device still in his hand, the video shows.

He was taken into custody a block away on New York Avenue, cops said. The officers were taken to a nearby hospital for minor injuries.

The suspect’s name was not immediately released and charges against him were pending Tuesday morning, cops said.