Deutsche Bahn chief Hartmut Mehdorn has faced criticism
The head of Germany's railway company, Deutsche Bahn, is stepping down after the company admitted spying on thousands of its employees.
Chief executive Hartmut Mehdorn is quitting after running the firm for nearly a decade.
The firm admitted that it conducted a surveillance operation on staff, intended to tackle corruption.
Mr Mehdorn said he had not been aware of the spying but expressed regret over what had happened.
"Even if I have not done anything wrong myself, the most important thing is to put an end to this destructive debate about the Bahn," Mehdorn said.
There have been calls in the media for him to resign but in a recent newspaper interview he vowed to stay on.
Deutsche Bahn, the country's biggest public company, has previously confirmed it employed investigators from a detective agency in Berlin to carry out covert surveillance operations on its employees.
It has also admitted monitoring staff emails to check whether they were being critical of the company's policies.
Mr Mehdorn has previously won plaudits for turning Deutsche Bahn into a profitable company.
Earlier on Monday the firm posted a 4.8% increase in pre-tax profits to 2.5bn euros (£2.3bn; $3.3bn).
As well as the controversy over spying, Mr Mehdorn has become embroiled in scandals regarding train safety and bonus payments relating to a planned privatisation of the firm.
Until now he's been able to count on the support of Chancellor Angela Merkel, who has backed him over previous confrontations.
But as she faces a federal election in six months, analysts have suggested her support could diminish.