Real Madrid have announced that head coach Jose Mourinho will leave the club at the end of the season after three years in charge of the Spanish giants.
Real Madrid president Florentino Perez broke the news at a packed news conference on Monday.
The 50-year-old Mourinho, who has been linked with a return to Chelsea, won the league and Copa del Rey at Madrid.
"Nobody's been sacked, it's a mutual agreement," said Perez. "We've decided to bring our relationship to an end."
Real are currently 13 points behind Barcelona in the league and were beaten by city rivals Atletico in the Spanish Cup final last Friday.
They also lost in the semi-finals of the Champions League in each of their three seasons under former Porto and Inter Milan boss Mourinho.
Real Madrid have two games left this season. They are away at Real Sociedad on 26 May before Mourinho takes charge at the Bernabeu for the final time on 1 June against Osasuna.
"The club and manager agree the timing is right to bring our relationship to an end," Perez added. "On behalf of the board of directors, I would like to thank Jose Mourinho for all his hard work.
"The team has improved in his three years and we wish him all the best."
Real had not won a trophy in the two years preceding Mourinho's appointment.
His deal was scheduled to run until 2016 after he had signed a contract extension following last season's La Liga success.
An agreement has been made on his exit now, though, with fellow former Chelsea boss Carlo Ancelotti tipped to replace him after he expressed his desire to make the switch to the Bernabeu.
Perez denied a replacement had been lined up to take over from Mourinho.
"We have no pre-contract signed with any managerial candidate," he said. "It's something we'll have to look at in the coming days."
Ancelotti, 53, has already asked to leave Paris St-Germain but the Ligue 1 champions insist the Italian is still under contract.
Mourinho's failure to win any trophies this season appears to have accelerated his departure from Madrid.
However, this season Mourinho has cast a sulky figure. He has argued with established players, such as Iker Casillas, Sergio Ramos and Pepe, and was sent from the dugout for protesting a referee's decision during the Copa del Rey defeat to Atletico.
Following Real's Champions League elimination by Borussia Dortmund, he hinted at a return to Chelsea.
"I know in England I am loved," he said. "I know I am loved by some clubs, especially one."
Mourinho won two consecutive Premier League titles during his three-year spell at Chelsea, which ended in September 2007, also lifting the League Cup twice and the FA Cup once.
During his tenure at Stamford Bridge, Mourinho won 124 of his 185 games in charge, including a 60-game unbeaten run at home in the league before surprisingly leaving the club in September 2007.