Messi, who has been at Barcelona since he was 13 and is their all-time top scorer, was found guilty in 2016 of defrauding the Spanish government of 4.2 million euros ($4.61 million) over income earned from image rights.
Barcelona captain Lionel Messi has said he considered leaving the club when he was investigated for tax fraud in 2013, saying he felt "badly treated" by Spain.
Messi, who has been at Barcelona since he was 13 and is their all-time top scorer, was found guilty in 2016 along with his father Jorge of defrauding the Spanish government of 4.2 million euros ($4.61 million) between 2007 and 2009 over income earned from image rights.
The Argentina international was handed a prison sentence of 21 months and ordered to pay a fine of 2 million euros.
He did not serve any jail time after exchanging his sentence for a fine of 250,000 euros, as in Spain defendants without a previous conviction are permitted to serve any sentence of under two years on probation.
He was first investigated in 2013, beginning a spate of tax fraud cases against top footballers in Spain including Cristiano Ronaldo, Javier Mascherano and Marcelo.
"Sincerely, at that time, I thought about leaving," Messi told Barcelona-based radio station RAC1 in an interview broadcast on Wednesday.
"Not because of Barcelona but because I wanted to leave Spain, I felt very badly treated and I didn't want to stay here any longer.
"I had my doors open to many clubs but I never got an official offer because everyone knew I really wanted to stay. This situation went way beyond my feelings for Barca."
Messi added that he felt he was made an example of by the Spanish tax authorities, who stepped up their efforts against tax fraud after Spain's deep economic crisis hit.
"I was the first and that's why they came down so hard on me. They made an example of me and showed that it was going to be like this for everyone. It was tough because of everything that was happening at that time," he said.