Germany has charged a spy who allegedly acted as a double agent for the US and Russia with treason, breach of official secrecy and taking bribes.

The 32-year-old, identified only as Markus R due to privacy rules, is accused of offering his services to the CIA in early 2008 while working for Germany’s foreign intelligence agency, the BND. Documents he gave the US spy agency would have revealed details of the BND’s work and personnel abroad, officials said.

“In doing so the accused caused serious danger to Germany’s external security,” prosecutors said in a statement. “In return the accused received sums amounting to at least €95,000 (£68,000) from the CIA.”

Shortly before his arrest in July 2014, Markus R also offered to work for Russian intelligence and provided them with three documents, again harming Germany’s national security, prosecutors said.

The discovery that the CIA had allegedly been spying on its German counterpart caused anger in Berlin, adding to diplomatic tensions between Germany and the US over reports about US surveillance of Angela Merkel’s mobile phone.

Following the arrest, the German government demanded the removal of the CIA station chief in Berlin.

Prosecutors said Markus R would have had access to sensitive documents because his job involved handling mail and classified documents for the BND’s foreign operations department.

German weekly Der Spiegel reported that the 218 documents Markus R allegedly passed to the CIA included a list of all BND agents abroad, a summary of an eavesdropped phone call between former US secretary of state Hillary Clinton and former UN secretary general Kofi Annan, as well as a draft counterespionage strategy. A spokeswoman for the federal prosecutor’s office declined to comment on the report.

If convicted, Markus R could face between one and 15 years in prison.