FRANKFURT (Reuters) - A Swiss man has been charged with being a spy by Germany’s federal prosecutor after he obtained details of secret Swiss bank accounts set up by Germans to evade tax.

The 54-year-old man, identified only as Daniel M., is suspected of having spied on the German state of North Rhine-Westphalia’s (NRW) tax authority and some of its employees for nearly four years until February 2015, Germany’s federal prosecutor’s office said on Wednesday.

The case triggered outrage in Germany after the man was arrested in April on suspicion that he tried to find out how German states obtained CDs containing details of secret Swiss bank accounts held by Germans in a bid to avoid tax.

The German federal prosecutor’s office said on Wednesday that the man, who has been in custody since his arrest, had gathered personal information on state tax investigators so that Swiss authorities could prosecute the officials involved in the purchase of tax data CDs.

It said he received close to 13,000 euros ($15,227) for the assignment, of which he passed on around 10,000 euros to a German security firm that helped him obtain the information.

He also placed a source at NRW’s tax authority, it said.

The state of NRW has for years irritated Switzerland by buying data as part of a crackdown on Germans stashing cash in secret accounts to avoid paying tax.

The state has spent 17.9 million euros since 2010 on data that has helped it recover nearly 7 billion in tax revenue.

The Swiss government has acknowledged that police asked intelligence agency NDB in 2011 to help with an investigation related to the stolen data in Germany but has declined to give more details.

($1 = 0.8538 euros)