Lionel Messi will end his 20-year career with Barcelona after the Argentine superstar and the Spanish giants were unable to overcome "economic and structural obstacles" to a new deal.

The announcement on Thursday that a player widely regarded as one of the greatest of all time is on the market will spark a scramble for his signature, with wealthy Paris Saint-Germain and Manchester City potentially in the frame.

Messi has played 788 games for the club -- a Barcelona record -- and won 35 trophies in a glittering career in Spain.

Barcelona had been expected to announce that the 34-year-old six-time Ballon d'Or winner would stay, but in a statement the club said negotiations had broken down.

"Although an agreement has been reached between FC Barcelona and Leo Messi it cannot be formalised due to economic and structural obstacles," the statement said.

"Faced with this situation, Lionel Messi will not be staying at Barcelona. Both sides deeply regret that the wishes of both the player and the club cannot come true.

Lionel Messi is leaving Barcelona
Lionel Messi is leaving Barcelona AFP / JORGE GUERRERO

"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."

Messi himself has yet to comment, possibly suggesting that there might be another twist in the saga.

Last month the Argentine forward finally landed a major international trophy with his country when they beat rivals Brazil to win the Copa America.

But there had been doubts over his future at Barcelona ever since he tried to leave last August as a free agent, citing a clause in his contract.

In a bitter standoff then between player and club, Messi bemoaned that Barca had had "no project or anything for a long time" but eventually agreed to line up for another year when the club threatened to take the issue to the courts.

In the 2020-2021 season, Messi showed little sign of his advancing age as he played 47 games in four different club competitions and scored 38 goals.

The man 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.

'Bombshell': Barcelona supporters gather in front of the Camp Nou stadium in Barcelona
'Bombshell': Barcelona supporters gather in front of the Camp Nou stadium in Barcelona AFP / Pau BARRENA

Despite his own performances, the season was a disappointment. Under new coach Ronald Koeman they 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 head over the Atlantic to Major League Soccer, although his former Barca teammate Neymar has said he would love to team up with him again at PSG.

Huge debts

In the background looms Barcelona's debts of several hundred million euros, putting the club under pressure to reduce the wage bill.

They 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.

At the same time Barcelona have recruited new players who were expected to please Messi including fellow Argentine forward Sergio Aguero, who joined the Catalan side from Manchester City as a free agent.

Spanish media reported this year that Barca paid Messi 555 million euros ($656 million) over four seasons from November 2017 to the end of last month.

Messi had been tightlipped about his plans, saying in rare interviews simply that "nothing has been decided".

But Joan Laporta had made keeping Messi at the club a priority ever since he was re-elected as Barcelona president in March.

The previous president, Josep Maria Bartomeu, was forced to resign after the club's members succeeded in achieving a vote of no confidence against him following Messi's attempt to leave.

Bookmakers were leaning towards Qatari-owned PSG as Messi's next destination.

"Punters think the Argentinian wizard's next destination is likely to be 1,000km north in Paris, with PSG the 5/6 favourites to secure his signature," said Darren Hughes of bookmakers.co.uk.

"For those that think the latest twist in this sorry tale may prove to be yet another double-bluff, Messi is 10/3 to start next season in Camp Nou."