By Sabine Siebold and Mark Hosenball
BERLIN/WASHINGTON (Reuters) - For this year's Independence Day bash the U.S. embassy in Germany picked the historic Tempelhof airport where an allied air lift 66 years ago kept Berlin's citizens from starving during Soviet leader Josef Stalin's blockade.
After a year scarred by the revelations of mass U.S. spying on Germans, the Americans had hoped to toast U.S.-German friendship with rock music, ribs, burgers and beer.
But that morning news had broken that Germany's Federal Prosecutor had arrested Markus R., a 31-year old employee of Germany's foreign intelligence agency (BND), on suspicion of spying for the Americans.
Hours later, the German Foreign Office announced it had called in U.S. Ambassador John Emerson for talks and to deliver "a swift explanation". For Emerson, hosting 2,500 guests that night, it was a pretty awkward party.
Revelations by former U.S. National Security Agency (NSA) contractor Edward Snowden last year that Washington spied on German officials - including bugging the phone of Chancellor Angela Merkel - had already brought relations between the United States and one of its closest allies to a new low.
According to both U.S. and German officials, Markus R. was a "walk-in agent" - someone who presents himself on his own to a foreign spy service and dangles an offer of secrets.
The Germans say the CIA should never have accepted.
"No intelligence service in the world can protect itself from the classic walk-in agent who offers their services elsewhere," a German security source said. "But it is a highly unusual and hostile act for an allied intelligence service to accept such a walk-in," the source added.
According to both U.S. and German sources, Markus R. had a desk job at the BND's vast headquarters in Pullach in southern Germany, working for a department responsible for the protection of soldiers serving abroad.
"He may have been craving thrills or attention. He'd worked for the BND for about 8-10 years," the German source said.
He approached the CIA by email in 2012, offering to provide them with information. As he worked in an area responsible for handling message traffic between headquarters and the German agency's out-stations around the world, he would have had access to a wide range of sensitive material.
On receiving his email, Austria-based CIA officers answered him and arranged further contacts. Most were by email, but he told investigators he also met a CIA contact three times in Austria, across a border just an hour's drive from Pullach.
During searches of his home, German authorities recovered a USB computer memory stick with 218 documents stored on it. Markus R. told them he had received 25,000 euros for the information, the German security source said.
To Berlin's anger, he also passed on documents about a parliamentary committee set up in the wake of Snowden's revelations to investigate the mass snooping on German citizens by the NSA. The deputy of one of the committee's eight members had visited Snowden in Moscow last year, and its head, Patrick Sensburg, said its members had feared they might be spied on.
The United States has refused to comment publicly on Markus R., but U.S. government officials privately acknowledge he had been in contact with the CIA and that the agency believed it had obtained valuable information from him.
But in espionage lore, the biggest problem with "walk-in agents" is that you can never fully know who else they might be working for. In the case of Markus R, the reason the CIA's man was finally caught was that he also tried to work for Moscow.
Agents from Germany's domestic intelligence service picked up an email he sent to the Russian consulate in Munich in late May this year, offering to sell BND documents to the Russians, according to German media and a U.S. source. The German agents replied to him, posing as Russians to lay a trap.
The Germans told their American intelligence colleagues they had located a suspected Russian spy in the BND - not realizing that the mole was working for Washington as well.
Within a day, an email address Markus R. had used vanished from the Internet. Only then did the Germans realize their man had been working for both Cold War superpowers, German media reported.
Markus R. was detained on July 2, and formally arrested and charged a day later.
"We don't take the matter of spying for foreign intelligence agencies lightly," Merkel's spokesman Steffen Seibert said.
That would not be the end of the affair. On July 9 the Federal Prosecutor's office said investigators were searching the Berlin home and office of a second suspected spy. The Defence Ministry said he worked in its headquarters.
The second man has not been arrested. German media reported that a payment he received from an American triggered suspicions he might be an American spy, but U.S. officials familiar with the case say he was in contact with a U.S. State Department officer rather than American intelligence agents.
According to the newspaper the Sueddeutsche Zeitung, Markus R. had tipped off the Russian consulate that Germany was investigating whether the second man was a spy for Moscow.
After the raid on the second man's home, Merkel decided enough was enough. Under public pressure to act, the chancellor agreed with ministers to ask the head of U.S. intelligence in Germany to leave - a highly unusual step.
"This is as a result of ongoing investigations by the Federal Prosecutor and because of questions left open for months
over the activities of U.S. intelligence in Germany," her office said in a terse statement last Thursday.
It is essential for Germany to work with western intelligence partners, in the interests of keeping German citizens safe, the statement continued. "But for this, mutual trust and transparency are necessary."
Asked on German television how angry she felt on learning about the two cases, Merkel replied: "It is not about how angry I was. For me it is a sign that we have fundamentally different conceptions of the work of the intelligence services."
"We are not living in the Cold War anymore and are exposed to different threats. We should concentrate on what is essential."
(Additional reporting by Thorsten Severin; Writing by Alexandra Hudson; Editing by Peter Graff)