Messi made the announcement in a video interview published by Goal.com. He said he wanted "to seek a new direction" in his career but would not "get into a legal dispute with the club."
The decision ended an impasse over his future that started when he told Barcelona 10 days ago that he wanted to leave the club for free at the end of the season.
Barcelona wanted him to finish his contract that runs until June 2021. It claimed that the clause invoked by Messi to leave had expired on June 10 and said that he had to pay the buyout clause of 700 million euros ($837 million) if he wanted to depart now.
"The president (Josep Bartomeu) always said that at the end of the season I could decide if I wanted to go or if I wanted to stay and in the end he did not end up keeping his word," Messi said. "The president always told me 'when the season is over, you decide if you stay or leave.' But he never set a date."
Messi had told the club about his intention to leave by sending a burofax, a certified document similar to a telegram.
"The burofax was simply to make it official that he was not following the rules, not to get into a fight because I did not want to fight with the club," Messi said.
There had been no agreement when Messi's father and Bartomeu met on Wednesday to discuss the player's future, with Jorge Messi saying his son wanted to leave and Barcelona saying it would not facilitate his transfer.
"I'll continue at Barcelona and my attitude won't change, no matter how much I have wanted to go," Messi said. "I told the club and the president that I wanted to go. I've been telling him all year. I thought my time in Barcelona was over, sadly — I always wanted to finish my career here."
Messi had not made any public statements since the team's 8-2 loss to Bayern Munich in the quarterfinals of the Champions League on Aug. 14. He said the defeat, one of the worst in his career, was not what made him decide to leave.
"It was a very difficult year, I suffered a lot in training, in games and in the dressing room," Messi said. "I wanted a winning project and to win titles with the club to continue expanding the legend of Barcelona. The truth is that there has been no project or anything for a long time, they juggle and cover holes as things go by."
Also read: Messi’s father arrives in Barcelona to discuss son’s future
Still, Messi said it wasn't easy to decide to leave the club.
"When I communicated my wish to leave to my wife and children, it was a brutal drama," he said. "The whole family began crying, my children did not want to leave Barcelona, nor did they want to change schools."