Serikjan Bilash, whose activism in defence of Muslim and Turkic minorities in Xinjiang earned him global media attention, told AFP he struck a plea bargain with the court that allowed him freedom but will end his activism.
"I had to end my activism against China. It was that or seven years in jail. I had no choice," Bilash told AFP at a restaurant where he held a celebratory midnight feast with his family and about 40 supporters.
Bilash agreed to accept guilt over inter-ethnic incitement charges triggered by his call for an "information Jihad" against the Chinese authorities over their policies in Xinjiang earlier this year.
He will also be unable to leave the city of Almaty -- Kazakhstan's largest -- for the next three months under the terms of his deal, he said, while noting he expected his supporters to continue taking the work of his informal Atajurt activist group forward.
"I had to do this for my family and my children," he told AFP as supporters in high spirits drank tea and ate a traditional meat-and-potato dish.
His release capped a dramatic night in Almaty, where some 200 hundred supporters surrounded the court where Bilash appeared and chanted for his freedom.
His lawyer Aiman Umarova had sounded the alarm earlier in the evening as she was unable to make contact with Bilash who had arrived at the courthouse before her and was immediately taken in by authorities.
Umarova refused to sign the plea bargain, insisting on her client's innocence, meaning Bilash had to find another lawyer to sign off on the deal.
"I refuse to put my name to any deal that was signed under pressure," Umarova told AFP.
Bilash had previously been held under house arrest after being detained and flown to the capital Nur-Sultan in March.
Critics connected his arrest to pressure from Kazakhstan's economically powerful neighbour.
The Communist Party's dragnet in Xinjiang has swept up an estimated one million ethnic Uighurs and other mostly Muslim minorities into "vocational education centres" that numerous studies and reports say are harsh internment camps.
With a population of at least 1.5 million, Kazakhs are the second largest Turkic group in Xinjiang after the Uighurs.
In July a court in Nur-Sultan ruled to transfer his case to Almaty, where the family of Bilash -- an ethnic Kazakh who was born in Xinjiang but obtained Kazakh citizenship as an adult -- are based.
Fiery orator Bilash had told the court Beijing was perpetrating a "genocide" against Turkic minorities in Xinjiang while "Chinese soft power" was working to "occupy our minds" in the Central Asian state.
Kazakhs living in Kazakhstan have used Bilash's group Atajurt to appeal to the Kazakh government to lobby China for their relatives' release.
Some supporters gathered outside the courthouse sporting t-shirts advertising a bid to nominate Bilash for the Nobel Peace Prize were former residents of Beijing's notorious centres in the region.
Earlier this month, a man who returned to Kazakhstan after spending a year-and-a-half trapped in Xinjiang told AFP he believed Bilash's activism had forced his release.
"Without Serikjan and Atajurt, I would not be here," said Tursynbek Kabiuly, who had his passport confiscated and was interrogated for six consecutive days in a jail after crossing into China to attend a relative's funeral.
Kazakhstan's foreign ministry has engaged in quiet diplomacy with major trade partner China on Xinjiang but has been reluctant to promote its efforts given sensitivities over the region.
Last year the ministry said China had allowed 2,500 ethnic Kazakhs to leave the country and enter Kazakhstan "as a kind gesture" but refused requests for further information.
Kazakhstan, an oil-rich, landlocked country of 18 million people has positioned itself as the "buckle" in President Xi Jinping's flagship Belt and Road international infrastructure drive.