Beijing (AFP) - China has legalised overseas counter-terror operations by its military, details of a controversial new law showed, as it tries to tie violence linked to mainly Muslim Xinjiang into global concerns about extremism.

Under the counter-terrorism legislation passed at the weekend Beijing "may send personnel outside the border to carry out anti-terror activities" when the "relevant country" agrees, according to the text published by the official Xinhua news agency.

The measure applies to the People's Liberation Army, the People's Armed Police and employees of the country's public security organs, Xinhua said.

In recent years the People's Republic has increasingly moved away from Deng Xiaoping's dictum of "keeping a low profile" in foreign and military affairs.

It is expanding the reach of its armed forces far around the world, seeking to build a "blue water" navy capable of operating in distant seas and commissioning its first aircraft carrier, the Liaoning, in 2012.

In November Beijing announced it would build a logistics hub in the African nation of Djibouti to support its units on United Nations and anti-piracy missions in the region.

China is a top contributor of peacekeepers to the continent and has helped patrol the waters off the lawless Somali coast.

Beijing has long proclaimed its belief in non-interference in other countries' domestic affairs, but two years ago a top public security official said it had considered a drone strike against a drug lord in Myanmar linked to the murders of 13 Chinese sailors.

The new legislation could apply to similar actions in the face of situations such as the November murder of a Chinese citizen by the Islamic State group.

The law establishes a co-ordinating body to "direct national counter-terrorism work", the text published overnight read.

Within China, the government has tightened social controls both online and on the ground, and the counter-terrorism bill could further reduce space for dissent.

Story continues

Critics say the new rules give authorities wide scope for interpretation over what is harmful to state security.

The law is "terrible news for peaceful govt critics, the rule of law, ISPs (Internet service providers), businesses and many others in China", Sophie Richardson, China director for overseas campaign group Human Rights Watch, said on Twitter.

The measure compels companies to cooperate with requests from the government to hand over data or communications related to terror investigations, fining or jailing anyone who does not comply.

But provisions in earlier drafts that would have obliged them to install "back doors" in products or turn over encryption keys to Beijing -- over which US President Barack Obama raised concerns -- did not appear in the final version.

Beijing has tightened social controls as it seeks to silence critics of its policies in Xinjiang, particularly those who say violence by ethnic minority Uighurs is a reaction to government discrimination and to controls over their culture and religion.

Last week a court imposed a three-year suspended prison sentence on civil rights lawyer Pu Zhiqiang, for offences including having "incited ethnic hatred" between Uighurs and the Han majority.

The accusation related to posts on his social media account suggesting Beijing was partly to blame for inter-ethnic violence.

Days later Beijing declined to renew the visa of French journalist Ursula Gauthier after she refused to apologise for writing an article expressing similar sentiments.