TEHRAN, Young Journalists Club (YJC) - Daniel Moser, 54, was arrested in the German business capital Frankfurt in April on spying charges after he compiled information on officials tasked by the German state of North Rhine-Westphalia with uncovering wealth hidden at Swiss banks.
In a statement read out by his lawyer to Frankfurt's superior regional court, Moser named his Swiss spy handlers and said he was paid 28,000 euros ($33,000) for the job.
He denied acting with criminal intent and said he was driven by "patriotism, love for adventure, profit-seeking motives and indignation".
As a former policeman, Moser said he merely sought to uncover criminal behavior on the part of German tax officials.
Switzerland had been seeking the identities of three German tax officers, hoping to build a case against them for illegally obtaining banking data, which are protected under the country's strict secrecy laws.
Swiss banks have come under intense pressure in recent years as several German states started buying CDs or USB memory sticks allegedly containing data on German taxpayers who had parked their fortunes across the border.
Fearing prosecution, many of Germany's rich and famous subsequently came forward to declare their hidden wealth, boosting the tax coffers of Europe's biggest economy by billions of euros.
In the extraordinary court statement, Moser, who once worked as a security officer at Swiss banking giant UBS, voiced regret for his action.
He described himself as a "middleman" between the Swiss secret service and a security company -- which apparently helped to compile information on the targeted individuals.
Prosecutors had also accused Moser of placing a mole in the German tax service, but the defendant had denied the claim at last week's opening of the trial.
Moser risks up to five years in jail.
But the presiding judge had said the trial could close with a suspended sentence of up to two years and a fine of around 50,000 euros if Moser's confession proves to be "credible and comprehensible".
The spying case had sparked outrage in Germany, with Foreign Minister Sigmar Gabriel rebuking Switzerland over the scandal and summoning Bern's envoy for clarification.
It was especially embarrassing for Switzerland, which in 2015 had signed a deal with the European Union to exchange bank data starting in 2018 as part of an international pledge to clamp down on tax cheats.
Amid the uproar, German and Swiss media reported that the accused's operation had unravelled by chance, possibly because he had walked into a trap set by Werner Mauss, a former top spy dubbed Germany's James Bond.
Moser reportedly passed on a CD containing banking data to a German contact -- who had in fact been working for Mauss.
The data turned out to be erroneous, but Mauss reported the exchange to UBS, which in turn passed it on to Swiss authorities who arrested Moser in February 2015 for breaching banking secrecy.
It remains unclear who Mauss was working for in that case, and what motivated him to target Moser.
While interrogated by Swiss police over the CD, Moser apparently told them he had been tasked by their secret service counterparts to spy on German authorities, Reuters reported.
But a copy of a summary of the interrogation ended up in the hands of German authorities through Mauss, leading eventually to Moser's arrest in Frankfurt.
Mauss himself was earlier this month found guilty of tax evasion. He was given a two-year suspended sentence and ordered to donate 200,000 euros to charity.