Four thugs came to a Brooklyn courtroom this week to try to bully a 17-year-old girl into silence as she testified about years of sexual abuse she says she suffered at the hands of a prominent leader of the ultra-Orthodox community.

It was an outrageous violation of decency, custom and law — and Brooklyn District Attorney Joe Hynes’ duty is clear: The four must be punished to the max.

The case involves a brave young woman who was sent by her school to see Nechemya Weberman, 54, for counseling beginning when she was 12.

She says he sexually abused her weekly for three years — and that her life got worse when she reported him to the police. Men allegedly threatened her family and also tried to bribe them with $500,000 to drop the charges.

She refused to go along.

This week, Weberman’s supporters in the gallery started taking cellphone photos of the girl as she testified. One man managed to upload a photo of her to Twitter before the judge caught on and had all their cellphones confiscated.

It was an egregious violation of the girl’s privacy. Taking photos in court undercuts the ability to protect a sexual-assault accuser’s identity and safety.

“Now we have to take all their phones, just like in a gang trial,” a law-enforcement source told The Post. “It’s the same thing you have with the Bloods or the Crips.”

In a way, it’s worse.

Forget the Bloods and Crips — these were the Satmar, an ultra-Orthodox sect whose members often behave as though they have special rights, as though the laws of New York don’t apply to them.

Well, for years, they’ve been right.

Hynes used to wink at such conduct, as The Sunday Post has reported for years — mostly letting the ultra-Orthodox settle affairs on their own.

He long refused to make public the names of ultra-Orthodox Jews who were charged with sexual abuse — even after they were convicted of serious crimes.

That is, he afforded the same protections and anonymity to molesters that DAs are supposed to give to victims of abuse.

That only worsened the culture of secrecy and intimidation in Brooklyn’s ultra-Orthodox communities.

But that’s no longer an option.

Now that these four have extended the practice of witness intimidation all the way into the courtroom, Hynes is obligated — legally and morally — to fight back aggressively.

They have been charged with misdemeanor criminal contempt, which could land them in prison for 12 months each.