BEIJING — Before the Chinese human rights lawyer stood trial for subversion, he wrote a letter saying he would confess to such charges only if he was tortured.

But on Monday, the lawyer, Xie Yang, appeared at court a drastically altered man. He had become a seemingly contrite actor in a trial intended to discredit China’s struggling dissident lawyers who take up contentious cases and want courts freed of Communist Party control.

“I feel ashamed and deeply remorseful for my past actions,” Mr. Xie said at his trial in Changsha, a city in southern China, according to transcripts issued online by the court. “Everyone should take me as a warning to certainly stay within the framework of the law, and avoid being exploited by Western anti-China forces.”

At the trial, Mr. Xie withdrew his claims of torture, which were laid out in piercing detail in transcripts of meetings shared earlier by his former defense lawyers. He pleaded guilty to the subversion charge and a charge of disrupting court proceedings. And he placed blame for his years as a combative lawyer on seductive but toxic ideas about constitutional government learned from study sessions abroad.