Bayern Munich vice chairman Jan-Christian Dreesen has confirmed that an agreement in principle has been reached with Real Madrid midfielder Xabi Alonso.

"We're in discussions with Alonso and Real, but we have an agreement in principle with the player. We're looking to complete the deal within the next two days," Dreesen said as quoted on Bundesliga.com

Alonso, who recently retired from international football, is said to be due in Munich on Thursday for his medical ahead of his proposed move to the Bundesliga champions.

Pep Guardiola has been looking for a deep-lying central midfielder post the departure of Toni Kroos to Real earlier in the summer, and that search intensified after midfielder Javi Martinez suffered a serious knee-ligament injury, ruling him out for a long period of time.

According to the Guardian, the Spaniard, who had two years left on his contract, is going to be joining Bayern on a two-year contract worth around £8m-a-year.

Alonso joined Real in 2009 from Liverpool and went to become a key player for the Los Blancos in the five seasons he spent at the Santiago Bernabeu.

However, following the arrival of Kroos and James Rodriguez, he saw his place in the team under threat and even though manager Carlo Ancelotti was reluctant to sell, it is believed that the club hierarchy welcomed Bayern's approach for the player.

Bundesliga champions Bayern were not the only ones interested in the midfielder. They had to face competition from Premier League giants Manchester United, after reports suggested that a bid was being readied for the 2010 World Cup winner.