Harvard Law School professor emeritus Alan Dershowitz wrote Saturday that President Donald Trump had respected the independence of the judiciary by appealing, rather than ignoring, a federal judge’s injunction against his executive order on immigration.

While Dershowitz, a noted Democrat and civil libertarian, was critical of Trump for calling Judge James L. Robart a “so-called judge” on Twitter, he observed that there was a distinction between Trump’s words and his actions.

Dershowitz wrote in Canada’s Globe and Mail:

President Donald Trump avoided a constitutional crisis by appealing, rather than defying, an overbroad injunction against his visa executive order issued by a federal judge in Washington State. Justice James Robart’s injunction is nation-wide in effect, despite another federal judge in Massachusetts having rendered a decision refusing to renew a similar injunction, and thus allowing the visa restrictions to be implemented. In light of these conflicting rulings, the President could have said that he was going to follow the one he and his lawyers believed was correct. Had he done so, the judge in Washington might well have held the President in contempt of court, thus creating a constitutional crisis between co-equal branches of our government. … Whatever one thinks about the merits or demerits of Justice Robert’s injunction – or of the Massachusetts Federal Judge’s refusal to renew the injunction – we are observing in action the American system of checks and balances, and separation of powers.

Conservatives frequently criticized President Barack Obama during his two terms in office for attacking the judiciary in public. The most notorious example was during his 2010 State of the Union address, when he criticized the Supreme Court for its Citizens United ruling — with six justices seated in front of him and the whole nation, unable to utter a response.

Obama also warned the Supreme Court publicly not to overturn Obamacare during the two cases where that had been a possibility. In 2012, after oral arguments went badly for him, Obama even questioned the power of judicial review itself.

The Obama administration also developed a bad habit of defying federal courts — first in Louisiana, where it continued a moratorium on deep-sea oil drilling in the Gulf of Mexico despite court orders to allow drilling to continue; and later in Texas, where the administration defied a judge’s order to suspend the “executive amnesty” program, and misled the court.

During the 2016 presidential campaign, then-candidate Trump faced criticism from both conservatives and liberals for comments about the Mexican-American judge presiding over the Trump University fraud case, which was recently settled.

Joel B. Pollak is Senior Editor-at-Large at Breitbart News. He was named one of the “most influential” people in news media in 2016. His new book, How Trump Won: The Inside Story of a Revolution, is available from Regnery. Follow him on Twitter at @joelpollak.