Barcelona's Brazilian forward Ronaldinho will sign for AC Milan on Wednesday, the Italian club has said.
"AC Milan and Barcelona have reached an agreement in principle over the transfer of Ronaldinho," Milan said in a statement on their Web site on Tuesday.
"The player will be in Milan tomorrow to undergo a medical and sign a contract that will keep him at Milan until June 30, 2011."
The Serie A side, who finished fifth last season and will be in the UEFA Cup this term, beat off competition from English Premier League club Manchester City for the 28-year-old.
Ronaldinho spent five years at the Nou Camp, helping Barca win the Champions League in 2006 and their domestic title in 2005 and 2006.
The Brazil playmaker was named FIFA World Player of the Year in 2004 and 2005 but has been allowed to leave Barcelona after suffering form and fitness problems last season.
His arrival at Milan seems to spell the end of their pursuit of Arsenal striker Emmanuel Adebayor with chief executive Adriano Galliani having consistently said only one of the two would come to the San Siro.
Coincidentally, Adebayor has been linked with Barca in the media.
Barcelona confirmed the deal on their Web site saying that the agreement is for 21 million euros ($33.5 million), plus another four dependent on Milan's qualification for the Champions League in the coming seasons.
The figures were less than the 32 million Premier League Manchester City were reported to have bid.
Ronaldinho's wish to go to Milan rather Manchester was the deciding factor.
Barca sports director Txiki Begiristain told reporters: "The player has ended up where he wanted to. He wanted to play for Milan."
He added that the player has relinquished 15 percent of his fee to ensure the deal went ahead.
Galliani, who has chased the Brazilian for three months on and off, flew to Barcelona at the start of the week and has been in talks with Barca and the player for the past two days.
Milan's website said Ronaldinho and Galliani will fly to Milan on Wednesday.
Ronaldinho could walk into an immediate row at Milan given his wish to represent Brazil at next month's Beijing Olympics.
Barca had refused to release him for the Games and Milan could make the same decision having already stopped compatriot Kaka from going to China.
Ronaldinho will join Mathieu Flamini, Gianluca Zambrotta, Marco Borriello, Christian Abbiati and Luca Antonini as new faces at Milan this season.
Coach Carlo Ancelotti has said he wants to play Ronaldinho alongside Kaka in a Christmas tree formation behind a striker.