Germany have appointed Julian Nagelsmann as manager on a contract until July 2024.

The 36-year-old succeeds Hansi Flick, who was sacked after a poor run of results, culminating in a 4-1 friendly defeat by Japan earlier this month.

Nagelsmann has been out of work since he was sacked by Bayern Munich in March after less than two years in charge.

Germany are hosts of next summer’s European Championship finals, which run from 14 June to 14 July 2024.

“We have a European Championship in our own country. That’s something special – something that happens every few decades,” said Nagelsmann.

“I have a great desire to take on this challenge. We will be a close-knit group next year.”

Nagelsmann’s first match in charge will be a friendly against United States in Connecticut on 14 October before facing Mexico in Philadelphia three days later.

“Julian Nagelsmann was our preferred candidate as national coach when the search began,” said German Football Association sporting director Rudi Voller.

“He is not only an absolute football expert, but has already proven in all his positions – at a very young age for a head coach – that he can motivate and inspire a team and the entire environment.

“His fire for football is noticeable and contagious.”

Nagelsmann is recognised as one of the game’s most promising managerial talents, having taking charge of Hoffenheim aged 28 before moving to RB Leipzig, leading the club to the Champions League semi-finals.

Bayern paid 25m euros (£21.7m) to Leipzig in 2021 to free Nagelsmann from his contract and succeed Flick at the Allianz Arena on a five-year deal.

He won the league title in his first season alongside two German Supercups, but was sacked in March after a run of five wins from 10 league games.

The former defender held talks with Chelsea and Tottenham over their managerial vacancies during the summer, but both clubs ultimately looked elsewhere.

Flick became the first Germany boss to be sacked since the role was created in 1926 when he was dismissed earlier this month, overseeing just 12 wins in his 25 matches since replacing Joachim Low in August 2021.

Liverpool manager Jurgen Klopp was mentioned as a possible candidate in the German media in the aftermath of Flick’s departure, though he quickly reaffirmed his commitment to the Premier League side.

Voller, a former Germany striker, took temporary charge for a 2-1 friendly win over France three days after Flick’s exit.