RB Leipzig boss Julian Nagelsmann will join Bayern Munich on a five-year contract at the end of this season, the German champions have announced.
Current boss Hansi Flick said last week he wanted to leave the Bavarian club.
At 33, Nagelsmann is one of the most highly-rated young managers in Europe and led Leipzig to a Champions League semi-final last year.
“Julian Nagelsmann stands for a new generation of trainers,” said Bayern president Herbert Hainer.
The German, who will take over on 1 July, will reportedly cost Bayern more than £20m in compensation.
“I will leave RB Leipzig with a heavy heart,” said Nagelsmann. “It is something very special for me to take on the position of Bayern coach.”
Nagelsmann became the youngest head coach in Bundesliga history, aged 28, when he took charge of Hoffenheim in February 2016.
After moving to Leipzig in 2019, he led them to a third-place finish in the Bundesliga and the semi-finals of the Champions League in his first season.
This season, the East German club mounted a strong title challenge – looking to become national champions for the first time in their history – before Bayern earned a 1-0 win against them to take control of the race.
Nagelsmann’s side are seven points clear of third-placed Wolfsburg with three matches left to play.
They reached the Champions League last 16, where they lost to Liverpool, and will play Werder Bremen on Friday in the German Cup semi-finals.
“It’s still too early to say goodbye and otherwise talk about memories, because I’m not finished here in Leipzig,” said Nagelsmann.
“My mission will end in the summer, but until then it will continue at full throttle. We have grown into a sworn bunch that finally want a title.
“I have never made a secret of the fact I am excited about the coaching position at Bayern Munich and that I would be happy to take on this job if this unique opportunity should arise.”
Six trophies and another Bundesliga on the way – why is Flick leaving?
Flick has been heavily linked with the Germany national team job with Joachim Low set to quit after this summer’s European Championship.
Initially the assistant manager to Niko Kovac, the 56-year-old took over on an interim basis when the Croatian was sacked in November 2019.
Flick oversaw a stunning upturn in fortunes, winning the Bundesliga, Champions League and German Cup. He was rewarded with a contract until June 2023.
Bayern also won the Club World Cup in February, Flick’s sixth trophy in his first 16 months in charge.
However, the former Bayern midfielder became frustrated with the lack of new signings this season and found himself in a power struggle with sporting director Hasan Salihamidzic.
Bayern are seven points clear of second-placed RB Leipzig as they close on a ninth consecutive Bundesliga title, but Flick’s side were knocked out of the Champions League by Paris St-Germain earlier this month.
Bayern president Hainer praised Flick’s work and said he wanted to “expressly thank” the outgoing manager.
“He took over our team in a difficult phase in 2019 and then won six titles, the seventh will hopefully follow soon,” said Hainer.
“It will always have a place in the history books of FC Bayern.”