Wild video obtained exclusively by the New York Post shows a group of good Samaritans banding together to bring a crazed subway maniac to justice — after he allegedly stole a cellphone, then shoved a New York Times illustrator onto some Manhattan subway tracks during the Thursday morning rush.

NY Post (h/t Larry A) The attacker, identified by police as homeless man Nathaniel Brown, 41, can be seen pacing with agitation as he tries to evade the good guys. Brown, meanwhile, was arrested on charges of assault and resisting arrest, police said.

Brown, sporting a heavy Muslim beard, was also shouting “Allahu akbar” (Our God is Greater) — a common Muslim chant also used by Muslim extremists when they are engaged in acts of terrorism — when he was being arrested, sources said.

The clip shows a half-dozen brave straphangers calling for police and encircling the accused in order to block his escape, moments after the 10 a.m. incident on the F train platform at the Broadway-Lafayette station.

At one point, Brown rips off his shirt to wipe the sweat from his brow before trading blows with a passerby who tries to block his escape, footage shows.

He can also be seen bull-rushing though a phalanx of Samaritans, but as he’s charging upstairs, another quick-thinking commuter comes down the steps and heroically body-checks Brown backwards onto the ground, the clip shows.

Undeterred, he tries to get back up, but another straphanger hooks his ankle and sends him back to the ground.

Police sources say Brown first robbed someone of a cellphone on a No. 6 train at Spring and Canal streets minutes before. A phone was recovered on him, and police used the device to track down its rightful owner, sources said.

Then he got into an argument with a 30-year-old stranger at Broadway-Lafayette at 10 a.m. and shoved him onto the tracks, fracturing the man’s hip and leaving him with cuts, cops said. The fiend then spat on a 25-year-old who tried to help the first victim, according to police.

The 30-year-old victim was taken to Bellevue hospital, while the 25-year-old refused medical attention, cops said. The Post confirmed the older victim is an illustrator for the New York Times, but is withholding his identity, because he was not available for a comment.

Cops are investigating any possible Islamic terror ties, according to sources.