The attempted arrest of an allegedly hate-mongering teen aboard a Brooklyn subway quickly turned into a wild showdown between cops and a roiled mob, according to sources and video obtained by the Daily News.

The melee began when suspect Stephan Stowe, 17, and a group of eight friends approached a Jewish man wearing a yarmulke aboard a Brooklyn-bound 3 train just before 3 p.m. Monday, police sources said Wednesday.

“Assalamu Alaikum,” Stowe said to the man, using a common greeting among Muslims that means, “Peace be with you,” court documents allege.

When the man ignored the greeting, Stowe allegedly became combative.

“You think you’re better than me?” the teen allegedly said. “We are cousins.”

“No we’re not,” The man shot back, and told Stowe to leave him alone.

The suspect then started hurling ethnic slurs and called the man disrespectful, according to court papers.

As the tension aboard the train escalated, the man whipped out his cell phone and took a photo of Stowe, who then snatched the phone and deleted the photo, police sources said.

“I’m going to kill you right now,” Stowe said, according to cops and court records. He then swore at the man, according to cops and court records, and in an apparent reference to the Holocaust added, “They should have killed all of you.”

The man managed to swipe his phone back from Stowe and ran to alert the conductor, police sources said. As the train pulled into the Eastern Parkway/Brooklyn Museum stop, cops were waiting to collar Stowe, police sources said.

But that’s when a mob rose up against the cops.

A pair of police officers struggled to detain Stowe inside the empty train while the angry onlookers swarmed the station’s platform snapping video and yelling at cops, video first published by Gothamist on Wednesday shows.

Read more: nydailynews.com