BARCELONA - British-born U.S. technology entrepreneur John McAfee died on Wednesday by suicide in a Barcelona prison after the Spanish high court authorised his extradition to the United States on tax evasion charges, his lawyer told Reuters.

McAfee's lawyer, Javier Villalba, said the anti-virus software pioneer died by hanging as his nine months in prison brought him to despair.

During a court hearing last month, McAfee, 75, said that given his age, he would spend the rest of his life in jail if convicted in the United States. "I am hoping that the Spanish court will see the injustice of this," he said, adding "the United States wants to use me as an example."

McAfee had lived for years on the run from U.S. authorities, some of that time aboard a megayacht. He was indicted in Tennessee on tax evasion charges and was charged in a cryptocurrency fraud case in New York.

The colourful tech founder was detained on Oct. 3 at the Barcelona airport as he was about to board a flight to Istanbul with a British passport, a Spanish police source said at the time.

McAfee worked for NASA, Xerox and Lockheed Martin before launching the world's first commercial anti-virus in 1987. He sold his software company to Intel in 2011 and no longer had any involvement in the business. The program still carries his name and has 500 million users worldwide.

Spain's high court said on Wednesday it agreed to extradite McAfee to the United States. The regional justice department confirmed that a U.S. man aged 75 awaiting extradition was found dead in his cell on Wednesday. Prison authorities were investigating the cause of death.

McAfee still had opportunities to appeal his conviction but could not stand more time in jail, Villalba said.

"This is the result of a cruel system that had no reason to keep this man in jail for so long," Villalba said. U.S. prosecutors will likely ask the judge overseeing the tax evasion case to dismiss charges because of McAfee's death.

McAfee said in 2019 that he had not paid U.S. income taxes for eight years for ideological reasons. That year, he left the United States to avoid trial, largely living on a megayacht with his wife, four large dogs, two security guards and seven staff.

He offered to help Cuba avoid a U.S. trade embargo using cryptocurrency and sought to run for U.S. president for the Libertarian Party.

McAfee, who said in 2018 that he had fathered at least 47 children, lived in Belize for several years. He fled after police sought him for questioning in the 2012 murder of a neighbour. They ultimately said he was not a suspect.

He met his wife, Janice McAfee, when she solicited him as a prostitute while he was on the run, he said.

Janice McAfee said in a post on Twitter on Sunday, "Now the U.S. authorities are determined to have John die in prison to make an example of him for speaking out against the corruption within their government agencies... There is no hope of him ever having a fair trial in America."

McAfee was a prolific user of Twitter, where he had 1 million followers, and other social media.

He posted a profanity-laced video on YouTube in 2013 that mocked the difficulty of removing the software that bore his name from computers.

A number of cryptocurrency backers around the world on Wednesday posted tweets of condolence. In his last public tweet on June 18, McAfee wrote: "All power corrupts. Take care which powers you allow a democracy to wield."

(Reporting by Inti Landauro and Joan Faus, Editing by Cynthia Osterman and Howard Goller) ((Inti.Landauro@thomsonreuters.com;))