* To tax German nationals' money in secret Swiss accounts
* Agreement should net Berlin billions of euros
* Deal faces stiff opposition in German upper parliament (Adds details on deal)
By Sarah Marsh and Markus Wacket
BERLIN, Sept 21 (Reuters) - Germany and Switzerland signed an agreement on Wednesday to tax money stashed by German citizens in secret accounts that could net Berlin billions of euros and force the Swiss banking sector to clean up its act.
The bilateral agreement could resolve a diplomatic dispute that peaked when a Swiss politician compared a former German finance minister to a Nazi. But it still requires parliamentary approval, which could prove tricky in Germany.
"We both are convinced that we have solved an open dilemma in a good way with this deal that sometimes weighed on the relations between Switzerland and Germany," German Finance Minister Wolfgang Schaeuble told a news conference in Berlin.
Switzerland has struck a similar deal with Britain to regulate untaxed funds and is looking to settle disputes with other countries including the United States. [ID:nL5E7KH06Q]
"We don't want to have any untaxed money in Switzerland," Swiss Finance Minister Eveline Widmer-Schlumpf said.
To ensure people step forward and pay their tax bills, the deal has a provision requiring Swiss banks to pay 2 billion Swiss francs up front to Germany within 25 days of the deal coming into force. The money will then be re-credited as bills are settled.
There is also a clause to prevent tax dodgers from moving money to a place such as the Cayman Islands to circumvent the new deal.
Germany, whose nationals have an estimated 150 billion francs hidden in Swiss accounts, is increasingly eager to claw back funds as the worsening euro zone debt crisis expands its role as the region's main paymaster.
But in Berlin, the deal still has to pass through the Bundestag, Germany's lower house of parliament, and the Bundesrat upper house, where Chancellor Angela Merkel's government no longer has a majority.
German states run by the opposition Social Democrats (SPD) and represented in the Bundesrat have said they want to block the deal, which lets Switzerland preserve most client confidentiality, saying it is too soft on tax evaders. [ID:nL5E7KD3R2]
"We will form a political front against this deal," said SPD parliamentary leader Thomas Oppermann on Wednesday.
The states of Bremen, North Rhine-Westphalia and Saxony-Anhalt said they would not approve the deal in the Bundesrat.
Protesters outside the German finance ministry chanted, "Down with the tax agreement" and waved wads of fake money while holding up ironic cardboard heart cut-outs urging onlookers to "have a heart for tax evaders."
Under the deal, effective from 2013, existing funds will be taxed at a rate between 19 percent and 34 percent, based on how long the money has been stashed away and the rate of capital gains.
Future investment income and capital gains will be taxed at 26.375 percent, in line with Germany's current flat-rate withholding tax. <^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For a factbox on the deal, click on [ID:nL6E7JA1F5] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^>
COMPROMISE TOO SOFT?
Strict secrecy has helped Switzerland build up a $2 trillion offshore financial sector, and in recent years the country has faced an international campaign against tax evasion as cash-strapped governments seek to boost revenue.
But by introducing a withholding tax on income at the source, the deal with Germany heads off any automatic exchange of information with Switzerland on client accounts.
This goes against European Union efforts to clamp down on banking secrecy and has prompted strong objections.
"This quasi-tax amnesty is not only morally abject but also crazy from a fiscal policy viewpoint," Germany's main union federation, DGB, said in a statement on Wednesday.
"Tax evaders may remain anonymous and are even rewarded retrospectively and legalised," it said. "They can now transfer their money without anyone noticing into the next tax haven."
Switzerland has agreed to cooperate more readily in the hunt for tax cheats in exchange for Germany's agreement not to continue the practice of buying stolen bank data, an issue that had soured ties.
If they have good grounds to suspect fiscal evasion, German officials will be allowed to put in between 750 and 999 requests with their Swiss counterparts over a two-year period.
But they will not be able to launch any large-scale "fishing expeditions" for tax dodgers. Critics say this is not good enough.
Germany also agreed not to take legal action against employees of Swiss banks.
Credit Suisse (CSGN.VX), Switzerland's second-largest bank, said this week it would pay a fine of 150 million euros ($206 million) to end an investigation of its employees in the German city of Duesseldorf over allegations that they helped citizens dodge taxes. [ID:nL3E7KJ0H0]
Swiss regional bank Zuercher Kantonalbank (ZKB) [ZKB.UL] said on Wednesday it had been informed it was subject of an investigation by U.S. authorities. [ID:nL5E7KL0DF]
The deal with Germany follows a diplomatic flare-up between the two neighbours. Former German Finance Minister Peer Steinbrueck said the Swiss were like American Indians running from the cavalry due to the country's stance over tax evasion, prompting a Swiss politician to compare him to a Nazi. (Additional Reporting by Holger Hansen and Matthias Sobolewski in Germany and Catherine Bosley in Zurich; Editing by John Stonestreet, Catherine Evans and Steve Orlofsky)