Carlo Ancelotti has announced his contract at AC Milan has been terminated by mutual consent, and the Italian club have wasted no time by immediately installing Leonardo as his replacement.
The news clears the way for the Italian coach to be installed as Guus Hiddink's replacement at Chelsea.
Club vice-president Adriano Galliani confirmed former AC Milan and Brazil playmaker Leonardo, who has been working for the club as technical area activities manager, will be his successor.
Galliani said on Sunday evening: "Leonardo is our new coach and will be presented at the San Siro tomorrow at midday.''
It had been widely expected that Ancelotti would leave the San Siro at the end of the Serie A season. Milan claimed second spot on the final day of the season with a 2-0 win at Fiorentina.
The 49-year-old has been consistently linked with Chelsea, though he refused to confirm he had agreed to take over at Stamford Bridge.
He had another year on his contract but Milan's failure to mount a serious challenge to Inter Milan at the top of Serie A meant he had been under pressure.
He told Sky television: "In agreement with the club, we have decided to bring forward the expiry of my contract. This beautiful adventure at Milan is over.
"I can't say anything else official. I have not made any agreement with any other club.
"I am certainly not staying in Italy. But it is not certain that I am going to London for sure.'' However when he was told "good luck" in English, he replied: "This I won't understand until I arrive."
He was Serie A's longest serving manager having been appointed in 2001 after a spell at Juventus and led the Rossoneri to one Serie A title and two Champions League triumphs.
He had previously served the club with great distinction as a player for over 15 years.
Chelsea are on the lookout for a new permanent coach after sacking Luiz Felipe Scolari in February.
Kaka paid tribute to Ancelotti.
"Carlo Ancelotti is a person I have a very strong bond with thanks to these six years that I have spent here with him as my coach at Milan,'' he said. "I am grateful for what he has done for me and for what he has taught me.
"He gave me the opportunity to be known as a footballer across the world and I have won a lot with him. I wish him all the best in everything.''
Although not explicitly naming him, Ancelotti hinted that leaving Kaka behind will be his biggest regret about leaving the Rossoneri.
"There is one player I would like to take, but I cannot take him with me,'' he said.
Leonardo, meanwhile, joined Milan from Paris St Germain in 1997 and remained at the San Siro for four seasons before going back to his native Brazil.
He returned to Milan in 2003 before hanging up his boots after making 60 appearances for his country.
Since then he has spent his time working in the media and helping out with various charities.
He was named as part of Milan's technical staff early last year.