Alan Dershowitz has defended accused murderers O.J. Simpson and Claus von Bulow in court, but it appears his defense of President Donald Trump has crossed a line for some of his friends.

“ “For them, it is enough that what I have said about the Constitution might help Trump. So they are shunning me and trying to ban me from their social life on Martha’s Vineyard.” ”

The famed trial lawyer and Harvard professor lamented his plight in an op-ed published last week by The Hill, saying he’s been shunned for his defense of Trump’s “civil liberties.”

Dershowitz said he’s not a Trump supporter and he voted for Hillary Clinton, but he feels people unfairly brand him a fan of Trump because he has publicly opposed special counsel Robert Mueller’s investigation of the Trump campaign, on legal grounds.

“But that is not good enough for some of my old friends on Martha’s Vineyard,” he wrote. “One of them, an academic at a distinguished university, has told people that he would not attend any dinner or party to which I was invited.”

“Either you are for Trump or against him, and that is all some people need to know to make judgments about you,” he said.

Dershowitz went so far as to compare his social snubs to 1950s-era McCarthyism, when many innocent people were unfairly blacklisted and fired from their jobs after being accused of being communists.

His complaints didn’t garner much sympathy on social media.

Dershowitz said he’s learned one big lesson: “One good thing is that being shunned by some ‘old friends’ on Martha’s Vineyard has taught me who my real friends are and who my fairweather friends were.”