AC Milan have agreed a deal to sign Manchester City striker Mario Balotelli on a four-and-a-half-year contract, the Italian club have confirmed.

City manager Roberto Mancini said on Tuesday that Balotelli could complete his move after a medical on Wednesday.

Analysis James Horncastle European football writer Considering Balotelli's history with Inter, it's a fascinating transfer. He has never hidden his affection for Milan. Marco Materazzi revealed this week how Balotelli would every now and again turn up for training at Inter wearing Milan socks. As playful punishment, Materazzi would take the scissors to them. TV show Striscia la Notizia caught up with Balotelli and even got him to pull on a red and black shirt. Now he gets to wear one for real. Attention switches to 24 February, the date of the next Derby della Madonnina when Balotelli will face his old team Inter.

"Both clubs are talking about him," said Mancini. "Maybe tomorrow [Wednesday] they can close [the deal]."

The clubs are believed to have agreed a fee of 22m euros (£19m), rising to 25m euros (£22m) with add-ons.

"We love Mario, but he had this big chance to go back to Italy," added Mancini. "Milan started to talk to Manchester City in the last two days and they are very close."

The Italy international had travelled with City to London for their Premier League game against Queens Park Rangers, which ended 0-0, on Tuesday evening, but did not feature in the squad after Milan director Umberto Gandini confirmed a deal had been struck hours before kick-off.

Gandini said on Twitter: external-link "Transfer agreement for Balotelli signed with Manchester City. Medical is tomorrow [Wednesday] in Milan, then personal terms until 2017 will be signed."

Manchester City signed Balotelli for £24m in 2010 with the striker scoring 20 Premier League goals for the club.

Balotelli's departure comes weeks after he was involved in a training ground altercation with Mancini.

When Noel Gallagher met Mario Balotelli

That was the last in a series of controversies during his time with the Premier League champions.

In his first season at Manchester City he scored 10 goals in 28 appearances, but was also sent off twice - against West Bromwich Albion and Dynamo Kiev.

The 2011-12 season was arguably his most productive as he scored 20 goals in 40 appearances, and he provided the crucial assist for Sergio Aguero to score the title-clinching goal against QPR in May last year.

However, he still struggled with discipline on the pitch, picking up 11 yellow cards and he was also sent off in Premier League games against Liverpool and Arsenal, the latter prompting Mancini to suggest he would be willing to sell the striker.

Balotelli impressed for Italy at Euro 2012, notably scoring twice in the semi-final win against Germany.

However, he failed to build on that when he returned to domestic action with Manchester City this season and found himself behind Aguero, Carlos Tevez and Edin Dzeko.

In total, he made 20 appearances during the current campaign, 12 of those from the bench, and scored three goals, the last of which came in a 2-0 victory at Wigan on 28 November.