Real Madrid made it official on Friday that Carlo Ancelotti is leaving the club after the end of the Spanish league this weekend.
Ancelotti had already been announced as the next Brazil coach but the Spanish club had yet to make any announcement about his departure. Ancelotti had another year left on his contract.
"Real Madrid and Carlo Ancelotti have reached an agreement to bring an end to his time as Real Madrid coach," the club said in a statement. "Our club wishes to express its gratitude and appreciation for a man who is a true legend of both Real Madrid and world football."
Madrid will pay tribute to Ancelotti on Saturday during the team's final match of the league season against Real Sociedad in the Spanish league at the Santiago Bernabeu Stadium. Also bidding farewell on Saturday will be veteran midfielder Luka Modric.
"Carlo Ancelotti will forever be part of the great madridista family," Madrid club president Florentino Perez said. "We feel incredibly honored to have had the chance to enjoy a coach who has helped us achieve so much success, but who has also embodied our club's values in such exemplary fashion."