Hackers broke into the computer systems of the Barack Obama and John McCain campaign teams during the US presidential race and stole a ''serious amount of files" in an operation that US government cyber experts believe originated from China.

The Secret Service and FBI warned Obama and McCain earlier this year that their computer networks had been infiltrated by foreign hackers who downloaded large quantities of information from the campaign networks.

"You have been compromised, and a serious amount of files have been loaded off your system," an FBI agent said, according to a report in Newsweek magazine.

The report went on to say that technical experts speculated the hackers were Russian or Chinese. The FBI apparently told Obama the attack had not been carried out by political opponents.

US officials said they discovered that the cyber attacks originated in China but do not yet know if they were government-sponsored or from an unaffiliated source.

The incident was first revealed in a Newsweek report that said the FBI and Secret Service told the Obama team of the attack in the summer.

According to the article, Josh Bolten, the White House chief of staff, called David Plouffe, who was Obama's campaign manager, saying: "You have a real problem … you have to deal with it."

It is understood the campaigns then hired private cyber security companies to look into the breaches.

The Secret Service and the McCain and Obama campaign teams have made no comment on the alleged attacks.