HONG KONG -- China has released a Christian lawyer who defended churches against a government crackdown, after a seven-month detention that attracted international condemnation and led to calls for his release from the U.S. government. But activists said that despite Zhang Kai's release, which comes ahead of a planned meeting between U.S. President Barack Obama and Chinese President Xi Jinping next week, China was continuing with a crackdown on civil society, with lawyers among its main targets.

Zhang, 36, posted a message on Chinese social media late Wednesday saying he had “safely arrived" at his family's home in Inner Mongolia. He was detained last August, shortly before he was due to meet David Saperstein, the U.S. ambassador-at-large for religious freedom, who was on a fact-finding mission to China. Zhang had been prominent in defending churches in the southeastern city of Wenzhou, which were targeted by a local government campaign to demolish large crosses and other buildings the authorities said were illegal structures.

The lawyer, himself a Christian, had become deeply involved in fighting the campaign, which is said to have affected more than 1,200 churches. He moved his home to Wenzhou in order to throw himself into his work, and is reported to have defended some 100 churches. Zhang was detained at one of the churches where he was working, and held under what China calls “residential surveillance” for six months, before reportedly being formally arrested last month on charges of disturbing public order and endangering state secrets. Chinese media had previously accused him of promoting illegal religious gatherings.

In late February, he appeared in a televised interview, in which he acknowledged colluding with foreign groups and threatening China’s national security, though rights groups said the comments appeared to have been made under duress. 

Beijing has described foreign calls for his release as interference in its domestic affairs. But analysts noted that the release comes before a planned meeting between presidents Xi and Obama at a nuclear security summit in Washington next Thursday.

Observers said it was not yet clear whether Zhang's release was part of a bail agreement, or whether he could still face trial. But the news was cautiously welcomed by human rights activists. U.S. envoy Saperstein tweeted that he was relieved to hear news of Zhang’s release -- though he said “he should never have been detained, and should be free from future harassment.” And other experts pointed out that other lawyers and civil rights activists remained in detention.

Zhang’s detention was seen by many experts as part of a concerted strategy by the Chinese leadership to reduce the influence of civil society groups, activists and lawyers. Last year, the government rounded up some 200 lawyers and legal activists for questioning, and more than 30 remain in detention, most of them associated with a Beijing law practice that specialized in defending citizens with grievances against the government. Xu Zhiyong, a prominent civil rights lawyer, was also jailed for four years in 2014 for "disturbing public order," while another leading lawyer, Pu Zhiqiang, was recently given a suspended three-year prison sentence, which disqualifies him from working as a legal professional in China.

The strategy of televised confessions has also been used repeatedly to discredit groups seen by the government as a threat: In his confession last month, which activists said appeared to have been scripted, Zhang said he wanted to “warn so-called human rights lawyers to take me as a warning and not collude with foreigners, take money from foreign organizations, or be engaged in activities that break the law or harm national security and interests.”

Yet the onslaught on civil society, which critics say is a sign of President Xi’s anxiety at the increasing willingness of China's citizens to express their views online, and at the stresses of a slowing economy, has prompted concerns among some ordinary citizens. A Chinese judge recently spoke out publicly against the use of televised confessions, while several prominent figures have criticized a recent call by Xi for China’s media -- which has also become more diverse in recent years -- to put the interests of the Communist Party as its top priority.

German President Joachim Gauck, in a speech during a visit to Shanghai this week, criticized communist former East Germany for silencing and locking up people who expressed opinions contrary to those of the country's  leadership, and said Germany was concerned about the state of civil society in China. He said a vibrant civil society was necessary for an “innovative and flexible society.”