Image copyright AFP/Getty Images Image caption Peter Dahlin was detained amid a wider crackdown on lawyers and rights activists

A Swedish activist who was detained in China on charges of damaging national security has been released and deported.

Peter Dahlin, 35, has been held since early January amid a crackdown on human rights lawyers and activists.

Last week he appeared on state media apparently confessing to breaking the law through his organisation's support of local Chinese rights lawyers.

The Swedish embassy confirmed he had left China but gave no further details.

Its foreign minister welcomed Mr Dahlin's release, but expressed concern about another Swede in Chinese detention.

More than 280 lawyers, legal assistants and associates were detained in a seemingly orchestrated government campaign last year - most have since been freed, but others now face trial while the whereabouts of others are still unknown.

Such moves contradict China's implementation of reforms explicitly aimed at strengthening the rule of law, say correspondents.

'Absurd' confession

Mr Dahlin is the founder of Chinese Urgent Action Working Group (China Action), which describes itself as a legal aid organisation.

It provides assistance to uncertified "barefoot" lawyers who provide legal aid in rural areas, and provides direct help to disadvantaged groups and individuals who have experienced rights violations.

Image copyright AP Image caption Mr Dahlin was released after confessing on television to "clearly violating the law"

Image copyright AFP Image caption Swedish national Gui Minhai also appeared on state TV in China, saying he had turned himself in

The group had said Mr Dahlin was detained on 4 January while en route to the airport for a flight to Thailand.

Last week, in a report on state television, Mr Dahlin appeared to confess to helping the Beijing law firm Fengrui - a number of the firm's lawyers have recently been charged with subversion.

Mr Dahlin said he had violated Chinese law, caused harm to the Chinese government and hurt the Chinese public.

China Action called the report "absurd" and said the confession appeared to be forced.

The group's US-based co-founder Michael Caster tweeted that Mr Dahlin's Chinese girlfriend, Pan Jinling, was also no longer in detention "but, contrary to some assertions, has not left the country".

Analysis: John Sudworth, Beijing correspondent

China's image as a sophisticated, rising superpower appears increasingly at odds with its toughening campaign against dissidents, activists and lawyers, and Peter Dahlin's case is a good illustration of that widening gulf.

Mr Dahlin found himself first held in secret detention, then paraded on state TV making a confession that had all the hallmarks of one written for him, before finally finding himself accused of being a foreign agent engaged in a mission to smear China.

Friends and colleagues of his say the charge would be absurd, laughable even, were it not for the fact that it carries such serious consequences. But unlike Chinese nationals facing the same arbitrary justice, Mr Dahlin had the benefit of a foreign government working on his behalf.

His sudden release may be the result of that intense diplomatic effort or it may simply be that he has served China's purpose in sending a chilling message to other foreign NGOs operating in China: engagement with Western organisations and values is fine in so far as they help boost China's capitalist economy, but they will not be tolerated if they are perceived to threaten Communist Party rule.

Sweden's Foreign Minister Margot Wallstrom said she remained "greatly concerned" about the status of detained Swedish national Gui Minhai.

Mr Gui is one of five people linked to a Hong Kong publishing house to disappear in recent months. He vanished while on holiday from Hong Kong in Thailand in October last year.

He also appeared on Chinese TV earlier this month, saying he had voluntarily handed himself over to the authorities over a drink-driving fatality years ago.

The case has sparked protests in Hong Kong from those who believe they were kidnapped by China and are being held because of allegations in a book they were working on, critical of the mainland.

Ms Wallstrom said Sweden's "efforts to get a clear picture of his situation and the possibility to visit him continue with undiminished force".

Mystery disappearances in Hong Kong book world

Gui Minhai: 51, disappeared in Thailand in October 2015 only to appear on Chinese TV earlier this month apparently confessing to a hit-and-run incident in 2003. The China-born Swedish national owns the Mighty Current publishing house

Lui Bo: last seen in mainland China, just north of Hong Kong, in October 2015. General manager of Mighty Current

Cheung Jiping: 32, last seen in mainland China in October 2015. Mighty Current's business manager

Lam Wingkei: 60, last seen in Hong Kong in October 2015. Manager of Causeway Bay bookstore

Lee Bo: 65 - also known as Paul Lee - disappeared in Hong Kong in late December 2015. A shareholder in Causeway Bay bookshop and a UK passport holder. Wife withdraws request for police to help find him in early 2016 saying he has been in contact from mainland China