Argentine superstar Lionel Messi is to leave FC Barcelona, the club has announced, citing "financial and structural obstacles" as the cause.
The national team captain will end his 20-year spell the Catalan giants after contract talks collapsed.
In a brief statement, the club said that "financial and structural obstacles" were to blame.
"Despite FC Barcelona and Lionel Messi having reached an agreement and the clear intention of both parties to sign a new contract today, this cannot happen because of financial and structural obstacles (Spanish Liga regulations)," it reads.
"As a result of this situation, Messi shall not be staying on at FC Barcelona. Both parties deeply regret that the wishes of the player and the club will ultimately not be fulfilled," it continues.
"FC Barcelona wholeheartedly expresses its gratitude to the player for his contribution to the aggrandisement of the club and wishes him all the very best for the future in his personal and professional life," it concludes.
Thursday's stunning announcement marked a new turnaround in a long-running saga where Barcelona had appeared certain to keep the Rosario-born star, widely regarded as one of the greatest players of all time.
Una locura! World Cup fever strikes again as two million fans vie for tickets to Argentina’s homecoming match
Messi had tried to leave last August as a free agent but the expectation was that he would remain with the Spanish giants for another five years, until 2026 when he would be 39.
The 34-year-old famously signed his first contract with Barcelona in 2000 on a napkin when he was just 13.
However, he had been a free agent since June 30 when his old agreement expired.
Previous reports have linked him with moves to French side Paris St Germain, English Premier League club Manchester City or even a move to the MLS in the United States.
Six-time Ballon d'Or winner Messi, 34, last month finally landed a major international trophy with Argentina when they beat rivals Brazil to win the Copa América.
But there had been doubts over his continuation at Barcelona ever since he tried to leave last August as a free agent, citing a clause in his contract and saying the club had had "no project or anything for a long time."
Messi, Barca's all-time top scorer and appearance maker, ultimately agreed to see out the final year as the club threatened to go to court.
The player, who signed his first contract with Barcelona in 2000 on a napkin when he was just 13, has been a free agent since June 30 when his old agreement expired after Messi had played 788 games for the club.
Last season was a comparative disappointment as the club could only land the Spanish Cup and exited in the last 16 of the Champions League, which they last won back in 2015.
There had been speculation that Messi would sign on for two years and then potentially head to Major League Soccer, although friend and former Barça teammate Neymar has said he would love to team up with him again in Paris.
Barcelona are labouring under debts of several hundred million euros and have been under pressure to reduce their wage bill.
The club recently sold left back Junior Firpo to Leeds United and US international Konrad de la Fuente to Marseille.
La Liga in 2013 introduced so-called financial "fair play" regulations setting a maximum amount of money each club can spend on its playing squad and coaching staff each season, conditioned by their income.
Investigators: Attackers of Messi's in-laws’ supermarket seeking ‘intimidation’ and ‘public impact’
At the same time Barcelona has recruited new players which were expected to please Messi, such as Sergio Agüero who joined the Catalan side from Manchester City as a free agent on a two-year deal.
Spanish media made much earlier this year of the reported 555 million euros paid Messi over four seasons from November 2017 to the end of last month.
National daily El Mundo splashed in January on what it termed "Messi's pharaonic contract which is ruining Barça" – that sum including image rights and a series of performance-related bonuses with the player reportedly earning a net 297 million euros.
Messi had been tight lipped about his plans. He granted just two interviews over the past year – one in December and the other at the end of the season – and both times he said "nothing has been decided."
But Joan Laporta had made keeping Messi on the team a priority ever since he was re-elected as Barcelona president in March.
"Leo loves Barça and knows that we are a big family. Hopefully that can help us encourage him to stay," he said at the time.
The last president Josep Maria Bartomeu was forced to resign in October after the club's members succeeded in achieving a vote of no confidence against him following Messi's attempt to leave.