A Taylorsville justice court judge who has been on the bench for more than two decades will be suspended for six months without pay for making politically charged comments about President Donald Trump.

In a decision released late Thursday, Utah’s high court ruled that Judge Michael Kwan violated their code of conduct on several occasions.

In January 2017, Kwan had an exchange that appeared to demean a defendant, according to the opinion, and included political commentary related to Trump’s immigration and tax policies.

The conversation revolved around whether a defendant had been paying fines. The person said he or she had planned to use a tax return to pay what was owed.

"You do realize we have a new president," Kwan asked, "and you think we are getting any money back?"

The defendant replied he or she hoped and prayed that would be the case.

"Prayer might be the answer," the judge 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."

The opinion states that Kwan argued this exchange was supposed to be funny, not rude. But the high court noted that it is “an immutable and universal rule that judges are not as funny as they think they are” and if someone laughs at a judge’s joke, it’s probably because of the power dynamic in the courtroom and not because the joke was actually funny.

The opinion also outlines a number of political comments that Kwan made on Facebook and LinkedIn about Trump when he was a presidential candidate. The judge also posted or shared articles about immigration, gun violence and voter participation.

The justices characterized Kwan’s posts about Trump as “blunt and sometimes indelicate” criticism. For example, just days after the presidential election, Kwan wrote, “Think I’ll go to the shelter to adopt a cat before the President-Elect grabs them all.”

And on the day Trump was inaugurated, Kwan wrote: "Welcome to governing. Will you dig your heels in and spend the next four years undermining our country's reputation and standing in the world? ... Will you continue to demonstrate your inability to govern and political incompetence?"

The Utah Supreme Court unanimously found that these comments violated rules that prohibit judges from publicly endorsing or opposing political candidates or doing anything that could undermine the judge’s independence or impartiality.

Kwan’s attorney, Greg Skordas, told The Salt Lake Tribune on Friday that they were disappointed but not surprised by the ruling.

“We never argued that the judge should not be sanctioned, but we felt and argued that a six-month suspension was too severe," Skordas said. “The Supreme Court obviously felt otherwise. We will honor that decision and abide by it.”

Kwan’s attorney also drew a parallel between this case and the narrow confirmation of Supreme Court Justice Brett Kavanaugh, who was accused of sexual misconduct leading to a dramatic Senate hearing. Kavanaugh denied any accusations of wrongdoing.

“It does strike me as troubling that one man ... sexually assaults a woman in college, publicly blasts the Clintons in front of a world wide 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.”

Taylorsville supports the punishment but expects Kwan to return to the bench after his suspension.

“We agree that it was an appropriate sanction and a proper penalty,” said city spokeswoman Kim Horiuchi. “Our primary focus now is ensuring a smooth court process, and we are working with the administrative office of the courts to ensure a seamless transition.”

Judge Ron Wolthuis will fill in for Kwan in Taylorsville’s justice court and may start as early as next week.

The opinion released Thursday was written by Justice John Pearce, who is the husband of Salt Lake Tribune Editor Jennifer Napier-Pearce.

Kwan had argued in response that his comments were protected under the First Amendment, and that his private Facebook posts were “constitutionally protected speech” that were not “expressly” critical of Trump when he was a presidential candidate. He acknowledged his comments became “more direct, critical and strident” after Trump was elected into office.

The Utah Supreme Court ruled that it could not consider that argument due to precedent but said that didn’t matter anyway — the conduct that Kwan did admit to was enough to warrant a six-month suspension.

In a recent interview with The Tribune, Kwan indicated he’s nearing retirement, although he did not set a date.

In addition to Kwan’s politically charged comments, he was also found to have violated judicial rules in February 2017 when he had a confrontation with a court clerk about a staffer who had been promoted without his involvement. Multiple people described him as “angry” and “screaming.” A short time later, Kwan submitted a written notice for disciplinary action, threatened the clerk with unpaid suspension pending termination and directed her to be escorted from the premises.

Kwan also has a history on being publicly reprimanded from the Utah Supreme Court, according to the opinion. He has been reprimanded in the past for a “crass in-court reference to sexual conduct and a former president of the United States,” and was also warned about participating as president of a nonprofit organization while on the bench.

That centered on his involvement in OCA — Asian Pacific American Advocates, a national group, with a Utah offshoot.

“The organization took public positions on a range of issues,” the opinion reads, “criticized candidates for political office, and posted articles and press releases online that include Judge Kwan’s name and judicial title.”

More recently, Kwan has served as the president of the Chinese Railroad Workers Descendants Association and was involved in planning events for the recent celebration of the 150th anniversary of the transcontinental railroad.

According to his LinkedIn profile, Kwan has been a justice court judge for Taylorsville more than 21 years. He is also an adjunct professor at Salt Lake Community College. He started one of the first DUI/drug courts in 1998.

Reporter Scott Pierce and editor Matt Canham contributed to this article.

Correction: 3:40 p.m., May 24 • This article was changed to remove part of a quote that listed an erroneous allegation against Supreme Court Justice Brett Kavanaugh.