HONG KONG — An activist who drew attention to the plight of Muslims held in Chinese indoctrination camps has been freed after months of detention in Kazakhstan, but his lawyer refused to sign his plea deal, saying she believed he had been threatened into accepting it.

The activist, Serikzhan Bilash, walked out of a courtroom late Friday in Almaty, Kazakhstan, surrounded by dozens of cheering supporters. He did not respond to messages seeking comment on Saturday. But the news agency Agence France-Presse quoted him as saying that under the terms of his plea agreement, he would have to stop his activism.

“It was that or seven years in jail,” he was quoted as saying. “I had no choice.”

Mr. Bilash, a naturalized Kazakh citizen who was born in China, had been a prominent advocate for people being held in a vast network of camps in the Xinjiang region in northwestern China. The Chinese authorities initially denied that the camps existed, but they now describe them as job and legal skills training programs meant to steer people away from extremism.

Scholars estimate that as many as one million Uighurs, Kazakhs and members of other predominately Muslim ethnic groups are being held in the camps, where former detainees have said that they were subjected to indoctrination programs meant to replace Islamic piety with devotion to the Chinese Communist Party.