CHINA has denied an accusation by US President Donald Trump that it hacked the emails of Hillary Clinton, his Democratic opponent in the 2016 election.

“We are firmly opposed to all forms of cyberattacks and espionage,” foreign ministry spokeswoman Hua Chunying said at a regular briefing on Wednesday.

She said China is a staunch defender of cybersecurity.

Mr Trump tweeted after midnight that China had hacked Ms Clinton’s emails, without offering any evidence or further information, and suggested that the FBI and Department of Justice should investigate.

Report just out: “China hacked Hillary Clinton’s private Email Server.” Are they sure it wasn’t Russia (just kidding!)? What are the odds that the FBI and DOJ are right on top of this? Actually, a very big story. Much classified information! — Donald J. Trump (@realDonaldTrump) August 29, 2018

“Hillary Clinton’s Emails, many of which are Classified Information, got hacked by China. Next move better be by the FBI & DOJ,” he tweeted some time between midnight and 1am.

US intelligence agencies have accused Russia of involvement in the hacking of Democratic emails during the 2016 election campaign.

The Justice Department has indicted 12 Russian intelligence officers accused of hacking into Ms Clinton’s presidential campaign and the Democratic Party.

Special counsel Robert Mueller is investigating Russia’s role in the election and whether there was any collusion between it and Mr Trump’s campaign.

Ms Hua also denied that China was building a military base in far-eastern Afghanistan after a report published by the South China Morning Post alleged that Beijing was constructing a counter-terrorism-focused facility near its border but inside the war-torn Islamic republic.

The report said China’s People Liberation Army could send hundreds of military personnel into Afghanistan after the base is completed.