Image caption Deutsche Bank, headed by Josef Ackermann, is tied closely with the country's fortunes

Deutsche Bank's chief is to leave next year, ending his nine-year reign at the top of Germany's largest lender.

Chief executive Josef Ackermann had been set to become chairman next year, but the decision had rankled investors and potentially flouted German corporate law.

He withdrew his candidacy on Monday.

The surprise announcement came the same day it emerged that police raided Deutsche Bank's offices over a case in which Mr Ackermann has testified.

Prosecutors in Munich searched the offices and the legal department at Deutsche Bank for four days last week, a spokesman told Reuters.

The court case - in which Mr Ackermann testified two weeks ago - is examining the collapse of Kirch Gruppe, a media group founded by the late mogul Leo Kirch.

Separately, Deutsche Bank agreed to pay $145m (£91m) to settle claims it misled five failed US credit unions over losses on mortgage-backed securities.

The bank did not admit any guilt.

'Extremely challenging'

After Mr Ackermann withdrew his candidacy to head the supervisory board, Deutsche Bank's nomination committee instead recommended Paul Achleitner, chief finance officer at insurer Allianz, for the role.

"The extremely challenging conditions on the international financial markets and in the political-regulatory environment demand my full attention as the chairman of the bank's management board," Mr Ackermann said.

"This does not allow enough scope for the many talks with individual shareholders necessary to implement the original plan."

Mr Ackermann was supposed to take over as chairman at the bank after he stepped down as boss next year, with Anshu Jain and Juergen Fitschen to take over as co-chief executives in May 2012.

But the decision to appoint him appeared to contravene German law stating that he needed at least 25% backing of shareholders to take the role without a two-year gap.

It seems he would have struggled to get that level of backing amid the legal case and market turmoil.

Last month, Deutsche Bank said that third-quarter profits beat expectations as gains in retail banking and asset management offset its exposure to Greek debt.

Pre-tax profits were 942m euros ($1.3bn; £820m) compared with analysts' forecasts of about 500m euros.