The end of a summer-long saga over the 28 year-old's future ended today when Liverpool issued a short statement effectively bringing to a close his spell on Merseyside.

The statement read: "Liverpool Football Club this evening confirmed they had reached agreement for the sale of Xabi Alonso to Real Madrid, subject only to a medical. The terms of the deal will remain confidential and undisclosed."

But although Liverpool will not reveal the details of the deal, privately sources were maintaining that manager Rafael Benitez had got his own way over the fee.

It is believed that Madrid made another attempt to end the deadlock today with an offer of £30m that will rise to £34m depending on Alonso's success over the first two years of what is believed to be a five-year contract.

Alonso had trained with his Liverpool colleagues this afternoon at the club's Melwood complex.

But as the Liverpool party headed for John Lennon airport and a charter flight to Norway for tomorrow's friendly with Lyn Oslo, Alonso was heading back to Spain.

Real Madrid issued a statement of their own, confirming he will have a medical tomorrow.

Assuming all goes well, he will join his former Liverpool team-mates Alvaro Arbeloa - who moved to Real last week for £3.5million - and goalkeeper Jerzy Dudek at the Bernabeu.

Alonso and Dudek were part of the famous night in Istanbul when Liverpool lifted the European Cup after a penalty shoot-out victory over AC Milan.

Now only Steven Gerrard and Jamie Carragher remain at the club from the 18 players on the team sheet in Istanbul that night.

Alonso's departure has been a long and painful experience for Liverpool fans, who had taken the Basque midfielder to their hearts.

Benitez tried to sell him last summer in the complexities of his unsuccessful fight to sign Gareth Barry from Aston Villa.

Alonso did not want to go then, and has always felt that he was being forced out of the club to finance the Barry deal.

This summer it was Benitez who did not want to lose the player, who is believed to have told his manager on the final day of last season that he wanted to return to Spain.

From that point on, Madrid waged a persistent war to sign the player as they assembled a new squad under president Florentino Perez.

With the Alonso deal, Perez will have spent around £220m in two months on Cristiano Ronaldo, Kaka, Raul Albiol, Esteban Granero, Arbeloa, Alvaro Negredo and Karim Benzema.

That haul is Madrid's response to Barcelona's historic treble of Champions League, La Liga and Spanish Cup.

But although Perez did not consider Alonso to be a player who 'will sell shirts', the Spain international has been almost as difficult to prise away from his club as Ronaldo.

Alonso was signed from Real Sociedad in August 2004 for £10.5million and scored 19 goals in 210 games, none more memorable than in Istanbul when he followed up to net when his penalty was initially saved in the Champions League final.

He also won the FA Cup, European Super Cup and the Community Shield while at Anfield.

In what used to be a very Spanish side, Liverpool will now have only Jose Reina, Fernando Torres and Albert Riera in their first-choice XI.

The deal looked on the cards when Liverpool and Real officials met in the team hotel ahead of Sunday's friendly in Barcelona against Espanyol.

But Liverpool have since made it clear the meeting was to make sure Madrid understood that the fee was non-negotiable.

Perez had previously claimed that it was far too high, but the club's coaching and backroom staff impressed upon him that Alonso was the key piece of a jigsaw, a holding player to create the platform for Ronaldo and Kaka to produce the attacking quality Madrid need to make a serious bid to take back the league and European Cup from Barcelona.

Now Benitez has the cash to spend on his own squad and is believed to want to close a deal to bring in midfielder Alberto Aquilani as Alonso's replacement.

Cash-strapped Roma are willing to sell for around £15million and the player is understood to be happy with a five-year contract worth around 4million euros a year.

It is believed that the player has agreed personal terms already, but negotiations could not be completed until Alonso was sold.

Benitez is also known to be considering moves for either David Silva or David Villa from Valencia.

But that could well push his budget to the limit unless he can offload the likes of Andriy Voronin.