The 34-year-old football superstar has spent all his career at the Spanish club but he had been trying to make an exit since last year.

Lionel Messi joined Barcelona when he was 13 and went on to become club's all time top scorer.
Lionel Messi joined Barcelona when he was 13 and went on to become club's all time top scorer. (AP Archive)

Lionel Messi will end his 20-year career with Barcelona after the Argentine superstar failed to reach agreement on a new deal with the club, the Spanish club has announced.

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

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

READ MORE: Hey Messi, you sticking around with Barca again?

Thursday's stunning announcement marked a new turnaround in a long-running saga where Barcelona had appeared certain to keep Messi, widely regarded as one of the greatest players of all time.

He 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 signed his first contract with Barcelona in 2000 on a napkin when he was just 13. He is the club's all-time top scorer and appearance maker with 672 goals in 778 games in all competitions.

However, he had been a free agent since June 30 when his old agreement expired.

Messi has spent his whole career at Barcelona and he was expected to sign a new deal with the Catalan club, which would have included a salary reduction of 50 percent.

Barcelona needed to financially restructure in order to get the deal over the line, which proved impossible in the end.

The news of Messi's exit comes a day after La Liga agreed in principle to sell 10 percent of a newly formed company housing most of its business to private equity firm CVC Capital Partners for $3.2 billion.

He remains without a club ahead of the 2021-22 season.

Source: TRTWorld and agencies