Xabi Alonso is on the verge of joining the German champions, Bayern Munich, on a two-year deal worth around £8m (€10m).

The former Liverpool midfielder, who on Wednesday announced his retirement from international football with Spain, is due for a medical at Bayern on Thursday as talks between the two clubs continue.

#FCBayern can confirm talks with @XabiAlonso & @realmadriden. Spaniard expected for a medical today. More soon on http://t.co/z5SEWp6rQd — FC Bayern English (@FCBayernEN) August 28, 2014

Bayern’s manager, Pep Guardiola, turned his attention to Alonso after the departure of Toni Kroos and the knee-ligament injury suffered by Javi Martínez. Alonso had two years left to run on his deal at Real Madrid and he turns 33 in November. His salary in Germany will be about €1m less than he was earning at Madrid.

Throughout last season Madrid’s coach, Carlo Ancelotti, insisted repeatedly on Alonso’s importance for the side. He missed the Champions League final through suspension after picking up a booking in the semi-final. In his absence, Madrid rarely functioned with the same fluidity. Yet, at boardroom level, the approach from Bayern Munich was welcomed.

The arrival of Kroos brought competition for Alonso, even if Ancelotti at first appeared likely to play the two together. But as discussions continued, Alonso did not play for Madrid in their opening league game of the season against Cordoba on Monday. Alonso was one of four deep-lying central midfielders along with Kroos, Asier Illarramendi and Sami Khedira, while the arrival of James Rodríguez increased the number of midfielders further, nudging him closer to a departure.