Image caption The National Security Agency is based in Fort Meade, Maryland, outside Washington DC

The US National Security Agency (NSA) broke privacy rules and overstepped its legal authority thousands of times in the past two years, according to documents leaked by Edward Snowden.

The incidents resulted in the unauthorised electronic surveillance of US citizens, according to documents published by the Washington Post.

Mr Snowden, a former NSA contractor, has leaked top secret documents to the US and British media.

He has been given asylum in Russia.

On Thursday, the Washington Post posted on its website a selection of documents it said had been provided by Mr Snowden, who fled the US in June after providing documents detailing NSA surveillance programmes to the Guardian and Washington Post newspapers.

'Operator error'

The documents purport to show that the unauthorised interception of telephone calls and emails of Americans and foreign nationals on US soil resulted from errors and departures from standard agency processes, including through a data collection method that a secret US surveillance court later ruled unconstitutional.

The documents offer more detail into the agency practices than is typically shared with members of Congress, the US justice department, and the Office of the Director of National Intelligence.

An internal audit dated May 2012 counted 2,776 incidents of unauthorised data collection over the previous 12 months.

The rate of violations grew significantly each quarter, from 546 in the second quarter of 2011 to 865 in the first quarter of 2012.

It is unclear how many individuals were subjected to unauthorised surveillance.

NSA auditors speculated the number of incidents jumped in the first quarter of 2012 because a large number of Chinese surveillance targets visited the US for the Chinese New Year. NSA surveillance of foreign nationals while they are on US soil is restricted.

According to an internal NSA audit report detailing the incidents in the first quarter of 2012, the majority occurred due to "operator error", usually from failure to follow procedures, typographical errors, insufficient research information, or workload issues.

Other incidents were attributed to "system error", such as a lack of capabilities or glitches and bugs.

Some data was intercepted when foreign targets entered the US - where NSA surveillance is restricted - but the system was unaware the target had entered US soil.

Other "inadvertent collection incidents" were targets believed to be non-Americans but who turned out to be US citizens upon further investigation.

In one instance in 2008, a "large number" of calls placed from Washington DC were intercepted after an error in a computer program entered "202" - the telephone area code for Washington DC - into a data query instead of "20", the country code for Egypt.

NSA reaction

In another case, the agency vacuumed up vast amounts of international data from a fibre optic cable running through the US into an NSA computer, where it was stored and analysed. Months later, the secret Foreign Intelligence Surveillance Court ruled the programme violated the search and seizure protections afforded by the US constitution.

Mr Snowden, 30, has been charged with espionage in a federal court in the US. He is currently in Russia, where the government of Vladimir Putin has granted him a year of asylum on the condition he cease disclosing secret US government information.

In a statement provided to the BBC, John DeLong, the NSA's director of compliance, pointed to internal privacy safeguards such as a hotline for people to report NSA activity they believe to be inconsistent with the rules.

"We take each report seriously, investigate the matter, address the issue, constantly look for trends, and address them as well - all as a part of NSA's internal oversight and compliance efforts," Mr DeLong said.

He said the agency's internal privacy compliance programme had a staff of 300, a fourfold increase since 2009.

US President Barack Obama has defended the series of programmes described in Mr Snowden's leaks, but has promised reforms to guarantee greater oversight.

"Given the history of abuse by governments, it's right to ask questions about surveillance, particularly as technology is reshaping every aspect of our lives," he said last week.