A Utah judge has been suspended without pay for six months after making critical comments – online and in court – about President Donald Trump.

The state supreme court ruled Judge Michael Kwan violated the judicial code of conduct several times and diminished “the reputation of our entire judiciary,” according to an opinion filed last week.

As a municipal judge in the Salt Lake City suburb of Taylorsville since 1998, Kwan deals with misdemeanor cases, violations of ordinances and small claims.

His lawyer, Greg Skordas, said Kwan accepted that he would face some punishment but is disappointed by the severity. In an interview with the Salt Lake Tribune, Skordas compared the case with Supreme Court Justice Brett Kavanaugh's confirmation hearings. Last September, Kavanaugh denied sexual assault allegations and blamed Bill and Hillary Clinton and "left-wing opposition groups" for publicizing the accusations.

'Calculated political hit':Brett Kavanaugh says accusations rooted in anger over Trump

Brett Kavanaugh:Legal whiz kid or partisan hack? Mentor to women or beer-loving frat boy?

“It does strike me as troubling that one man ... sexually assaults a woman in college, publicly blasts the Clintons in front of a worldwide audience and is confirmed to the United States Supreme Court," Skordas said, “while a city justice court judge outwardly supports his own Asian community, makes a joke about money being wasted on a wall in front of the six people in his courtroom and then is suspended without pay for six months.”

A January 2017 exchange between Kwan and a defendant, the state supreme court ruled, accounted for one violation because he demeaned the defendant while commenting on Trump's tax and immigration policies. The defendant said they planned to use a tax refund to pay fines, court documents say.

"Prayer might be the answer," Kwan replied. "‘Cause, he just signed an order to start building the wall and he has no money to do that, and so if you think you are going to get taxes back this year, uh-yeah, maybe, maybe not."

U.S.-Mexico border:Federal judge partially halts Trump border wall funding, blocks $1 billion

IRS:What was the average tax refund this year?

Kwan also posted comments critical of Trump on Facebook and LinkedIn, beginning in 2016, the state supreme court said. His Facebook account was private, but friends could have shared his posts.

In February 2017, Kwan wrote: “Welcome to the beginning of the fascist takeover. ... We need to be diligent in questioning Congressional Republicans if they are going to be the American Reichstag and refuse to stand up for the Constitution."

As an Asian American, Kwan was part of the 8% of non-white judges in Utah in 2010, according to the American Bar Association. At the time, seven of 83 judges in the state were people of color.

Kwan’s political affiliation is unknown because he chooses to keep his voter registration private, an option available to any state voter, said Justin Lee, Utah director of elections.

“Judge Kwan’s behavior denigrates his reputation as an impartial, independent, dignified and courteous jurist who takes no advantage of the office in which he serves,” Utah State Supreme Court Justice John A. Pearce wrote in the opinion.

Kwan isn't the first city judge to be reprimanded for political opinions. A municipal judge in Akron, Ohio, came under fire in 2016 after she attended a rally for Trump and stood behind him while holding one of his campaign signs.

Contributing: The Associated Press