A rabbi who was harassed and threatened with physical violence in a Long Island Costco recorded the encounter, leading to the arrest of the aggressor.

Rabbi Avrum Fri said late on Sunday in a Facebook post that the man later identified by police as Justin Pichizaca, 20, of Queens in the restroom of the Lawrence, Long Island store, said in the encounter: “[expletive] Jew, the Nazis will finish you off.”

Fri said followed the man out of the bathroom and told him to make the comment to his face, while recording with his cell phone.

Pichizaca twice made a move toward Fri to hit him. He said: “record all you want because a Nazi is going to f—— kill you.”

Pichizaca also threatened another Jewish customer, saying: “I’m going out to get my gun and will come back to shoot you up.”

During the extended rant, no one interceded in any way, Fri said.

The police officer who responded to Fri’s call said there was no case since once Fri followed Pichizaca out of the bathroom he “became the aggressor.” A second officer said his actions were not smart since Pichizaca “clearly” is mentally ill.

On Monday, Fri was called to the police station where the officers apologized. Pichizaca was arrested later that day and will appear in court on Tuesday.

Facebook removed the cellphone video for violating community standards.

“I do not recommend that most people do what I did,” Fri wrote in a second Facebook post on Monday night. “If you do not have the ability to defend yourself, it’s not worth the risk. What you can do is report events like this to the police, even if it can’t lead to charges. Post information on Facebook. Remain vigilant and teach the same to your children.”