Manchester United defender Gabriel Heinze has agreed to join Real Madrid.
Heinze had already conceded his United career was over
A statement on the Real Madrid website, confirmed by Man Utd, said the clubs had agreed a fee and Heinze will sign a four-year contract.
The Argentine had his heart set on a move to Liverpool and took his case to a Premier League tribunal after United refused to sell him to their rivals.
But after a League panel ruled against Heinze, the 29-year-old agreed to join Real for a reported £8m fee.
The move brings to an end Heinze's three-season stay at Old Trafford.
The defender proved a big hit with United fans when he arrived but after recovering from a serious knee injury at the start of the 2005/6 season, he found his first-team place occupied by Patrice Evra.
Liverpool tabled a bid of more than £6.8m in the belief United would be forced to sell after quoting that figure in a letter to Heinze's agent.
However, United refused to let the defender join their bitter rivals and though he considered an appeal against the Premier League's ruling, Heinze instead opted for a move to Spain.
Heinze will undergo a medical in Madrid before completing the move which will see him replace veteran Brazilian Roberto Carlos, who left the Bernabeu in the summer.