A history of Lionel Messi's nine deals at Barcelona as he signs to 2021

After a period of uncertainty, Barcelona have confirmed that Lionel Messi has committed his future to the club until 2021.

Messi's current deal was due to expire next summer and there has been speculation that he could leave the club, with Manchester City reported to be among the interested parties.

However, the 30-year-old has been the subject of similar speculation before and Barca always remained confident that he would extend his stay at Camp Nou. With his latest renewal, Messi has now signed nine professional contracts with the Catalan club, although, aged 34 when the latest one expires, there might not be many more.

Here's a recap of all the deals he's signed with the club -- and the times he's reported to have been close to leaving:

FEBRUARY 2004: Some nine months before he made his official debut for the Barcelona first-team, Messi signed his first professional contract with the club. It's probably not the most important contract signed during the Argentine's time in Spain, though, that honour would have to be bestowed upon the napkin signed by Charly Reach.

JUNE 2005: Now fully integrated into the first-team, Barca realised they had a real star on their hands. To that effect, they moved quickly to tie him down until 2010. The most interesting part of the teenager's new terms was that his release clause increased to €150 million, a clear sign of how highly he was valued.

SEPTEMBER 2005: Less than three months passed and Messi was signing another new contract as the euphoria surrounding him continued to rise in and out of Spain. Reports in the local press at the time suggested he doubled his salary as he committed to the Catalan club until 2014.

MARCH 2007: Less than two years passed until he penned another new deal. This time he didn't extend his stay at Camp Nou, but was handed a wage rise to a reported €100,000-a-week.

JULY 2008: Another year, another new contract, this time reportedly making him club's highest paid player as he inherited the departed Ronaldinho's No. 10 shirt.

SEPTEMBER 2009: Messi signed a new seven-year deal (until 2016) after winning the Champions League with Pep Guardiola against Manchester United in Rome. At the same time, his release clause was reportedly boosted to €250m.

FEBRUARY 2013: Given the flurry of contracts he'd signed in his first few years at the Camp Nou, it's somewhat surprising his 2013 deal was handed to him three-and-a-half years after he'd last signed a contract with the club. But this time he extended his deal until 2018.

MAY 2014: Reports in Madrid-based newspaper AS claimed Barca were seriously considering cashing in on Messi for €250m. Journalist Moises Llorens claims there was even an email sent to Jorge Messi, the player's father, promising the family 10 percent of any prospective deal. Paris Saint-Germain, Chelsea, Manchester City and Real Madrid were all linked.

MAY 2014: To the backdrop of those reports, Messi was also reportedly annoyed at how the season had gone under Tata Martino. Barca won nothing -- losing the league on the final day of the season at home to Atletico Madrid, who also knocked them out of the Champions League -- and felt the supporters were blaming him for the team's shortcomings.

MAY 2014: And aside from speculation, a post by the player himself on his Chinese social media site suggested all was not well: "The truth is that things have not gone as we expected -- it was a tough year, both personally and in the group. About my own situation, I am happy to stay at my home [Barcelona], as I have always said. It is the people in Barcelona who have to decide what to do about my future, but my choice is to stay once I feel the same affection from them. If not, then I will look for another solution because I will always want the best for this club."

MAY 2014: Any fear that he would leave were eventually ended before the World Cup in Brazil, though, as Messi signed an "improved" deal, although not an extension on his previous deal, which ran until 2018.

JANUARY 2015: Just over six months since that fuss, Messi's future was again in the spotlight. He missed an open training session after being left on the bench against Real Sociedad, then began to follow Chelsea players and the club on Instagram, fuelling rumours of a move to join up with Jose Mourinho of all people. It was suggested his relationship with his coach, Luis Enrique, was at breaking point. However, with the help of Xavi, Luis Enrique and Messi were able to overcome their problems.

JANUARY 2015: Messi felt compelled to appear on Barca TV to deny stories about his future. "Thanks for giving me the opportunity to give my version of events," he said of the Chelsea reports, going on to call them "lies." He added: "I have no intention of going anywhere, [the reports] hurt because they come from people who say they [support Barca]. I am just another player. Stop throwing s---."

JANUARY 2016: Having won the Treble the previous season, Messi firmly states he wants to finish his career at Camp Nou: "I've always said that I can't leave Barcelona. It's always my response. I want to finish my career at home and my home is Barcelona. Football changes so much. A year ago, we were all getting criticised and we ended up winning nearly everything. My intention is to terminate my career where it started, in Barcelona."

JUNE 2016: The Daily Mail claim Manchester United made several attempts to sign Messi.

JULY 2016: La Liga president Javier Tebas says he fears Messi could leave Barcelona and Spain due to charges brought against him and his father for tax evasion.

SEPTEMBER 2016: Not for the first time, Messi suggests he'd like to return to Argentine club Newell's Old Boys, where his career started, when his time at the top level in Europe ends: "I would love to [return to Newell's]. It is something I have kept an eye on because it was my dream as a child."

SEPTEMBER 2016: Josep Maria Bartomeu tells ESPN that Messi has a contract for life as the club begin to prepare an extension to his current deal, which ends in 2018.

OCTOBER 2016: Manchester City coach Pep Guardiola and CEO Ferran Soriano dismiss stories in Mundo Deportivo that City tried to sign Messi in the summer, saying they would never contact him. However, both are also keen to point out that if he ever decided to leave Barca, they'd be there waiting at the front of the queue.

NOVEMBER 2017: Barca take a risk by allowing Messi to move into the final 12 months of his contract, but they eventually reach an agreement for him to extend his stay at Camp Nou and announce it in July.

Almost four months later, the club confirm that the Argentina legend has signed up for another four years, until 2021. Now into his 30s, this is his ninth professional contract with the club. It may not prove his last, but there won't be many more.