An upstate judge resigned after posting a photo of a noose “with repugnant racial connotations” on his Facebook account, officials announced Tuesday, as the judge complained he had been “coerced” into leaving his position.

Kyle R. Canning began his judgeship at Altona Town Court in Clinton County in January 2018 and about a month later on Feb. 18 on his public Facebook page he put up a picture of a noose with the caption “IF WE WANT TO MAKE AMERICA GREAT AGAIN WE WILL HAVE TO MAKE EVIL PEOPLE FEAR PUNISHMENT AGAIN,” according to the Commission on Judicial Conduct.

The 29-year-old man — who received an $8,702 salary for the position — didn’t remove the post until six months later after the Commission sent him a letter about it August 27, 2018, the commission said.

“The noose is an incendiary image with repugnant racial connotations,” Commission Administrator Robert H. Tembeckjian said in a statement. “It is the very antithesis of law and justice. For a judge to use the image of the noose in making a political point undermines the integrity of the judiciary and public confidence in the courts.”

Canning — whose term was set to go through 2021 — resigned July 27 after he was charged by the Commission in May.

In his resignation letter, Canning said the Commission had “presented me with several different options in resolving what they claim to be a serious offense. I feel as though, due to my current financial situation and obligations to my family, I am being coerced into resigning.”

“I do formally apologize for the inconvenience and hardship that I have imposed on my co-justice and the Town of Altona,” the letter reads.

Under the terms of a July 10 agreement with the commission, Canning — who is not a lawyer — said he would not seek judicial positions ever again.

Canning told The Post he didn’t mean for the photo to be racist but rather to be a comment on the death penalty.

“The post was not a racist post. The whole post was pro death penalty. I am pro death penalty and it is not illegal to be pro death penalty,” Canning said. “None of that was in my mind when I shared my post. The noose was used for death penalty long before racism was ever a thing.”

He said the commission “painted me into a corner” because he couldn’t afford to hire a lawyer to fight the charges on his meager judgeship salary and his wages from his job as a delivery man for a bakery.

“I have house payments. I have two girls,” Canning said. “They gave me an ultimatum and being a father I had no choice. I could not spend a whole year’s salary to go down to New York to defend myself.”