Brazilian midfielder Kaka is returning to AC Milan, four years after leaving for Real Madrid, the Serie A club confirmed on Monday.

Milan said Kaka had agreed terms with chief executive Adriano Galliani for a two-year contract.

Kaka, 30, was a Milan favourite during six years at the club during which they won one Serie A title, the Champions League and the World Club Championship.

He never found his best at Real, making only 82 league appearances in his four years and losing his place in the Brazil team. 

Milan won for the first time in the new Serie A season on Sunday night by beating Cagliari 3-1 at the San Siro, and Kaka was watching from afar with great interest.

In his first words to reporters following the announcement of the deal, and before boarding a private jet to Milano Linate airport, he told Sky Sport Italia: "I'm going home.

"I'm happy and we have a great team. Last night I watched my Milan again. The San Siro? I just can't wait."