US Secretary of State John Kerry said that the US and China have agreed to work together on cyber security after accusing each other of hacking and Internet theft.

John Kerry was quoted by AFP as saying that cyber security affects everyone, and every nation has an interest in protecting its people, protecting its rights, and protecting its infrastructure.

"It affects airplanes in the sky, trains on their tracks, it affects the flow of water through dams, it affects transportation networks, power plants, it affects the financial sector, banks, financial transactions," Kerry said.

Chinese Foreign Minister Wang Yi was quoted by Xinhua as saying that cyberspace should be a field where China and the US can enhance mutual trust and cooperation.

The US and China have both been trading allegations in the past few months after American security firm, Mandiant, said a secret military unit in Shanghai is linked to an attack on some American companies’ websites.

China denied the claims by Mandiant and said it has also been a major victim of cyber attacks, most of which are from the US.

Earlier this month, the US-China Business Council criticised the new cyber security law which was meant to prevent US agencies from buying IT products from Chinese companies over security concerns.

Last month, a senior White House official said that cybersecurity has been a major challenge to the development of an economic relationship between China and the US.