HONG KONG — An American man who had been convicted of growing marijuana in Taiwan killed himself in a courtroom after he was sentenced to a four-year prison term, according to court officials.

The man, Tyrel Martin Marhanka, 41, slashed his throat with a pair of scissors on Thursday, the Changhua District Court said in a written statement. He was rushed to a hospital but could not be saved.

He had been convicted of growing marijuana at his home in Changhua, in central Taiwan, and of importing marijuana and opium poppy seeds. A prison term of up to seven years was possible, but the court gave him the lesser sentence because he had not sold marijuana and was growing it for his own use.

When a court interpreter told Mr. Marhanka the sentence, he replied, “Four years?” The Taipei Times reported, quoting witnesses. He said he did not want to appeal.