When it comes to humor, politicians are often the butt of jokes. This can be a problem, however, if the jokes are delivered by a judge.

That seemed to be the message of a ruling this past week by the Utah Supreme Court, which approved a six-month suspension, without pay, for Judge Michael W. Kwan of Taylorsville Municipal Justice Court, after he made politically charged comments in his courtroom about President Trump.

The Supreme Court said in its ruling on Wednesday that the comments — along with an online posting in 2016 critical of Mr. Trump — violated judicial rules on “independence, integrity, and impartiality.” The court noted that Judge Kwan, who was appointed to the municipal court in 1998 and subsequently re-elected by voters, had previously been disciplined for inappropriate political comments.

“It is an immutable and universal rule that judges are not as funny as they think they are,” the court said.