Xabi Alonso will step down as head coach of Bayer Leverkusen at the end of the season, the German club have announced.
Alonso has been heavily linked with the Real Madrid head coach position after a remarkable two and a half years at Leverkusen.
Last season, the former Liverpool and Real midfielder led Leverkusen to a domestic double, which included going unbeaten for the whole Bundesliga campaign.
They also reached the Europa League final before losing to Italian side Atalanta.
Leverkusen said they had agreed to Alonso's request to cut short his existing contract, which was due to run until the summer of 2026.
Leverkusen have been unable to hit the same heights this season, with their failure to beat Freiburg last Sunday confirming Bayern Munich as Bundesliga champions.
But Alonso’s reputation and stock remains extremely high and he could now take on arguably Europe’s most prestigious club job as head coach at Real, with Carlo Ancelotti set to depart at the end of the season.
Alonso told the German club's official website: "I owe great thanks to Bayer 04 Leverkusen, my players and staff, all the employees of the club and last but not least the fantastic fans. Our success was the result of an outstanding team performance.
"This club, who showed exceptional trust in me, very much deserved to win the German league title for the first time. My thanks and admiration go to everybody who helped to make this triumph happen including the DFB Pokal win in Berlin.
"Bayer 04 are ready for the future. The positive path will continue and I will be excited to follow it."