John McAfee, the eccentric British American software entrepreneur who sold his namesake anti-virus company in the 1990s and embarked on a globe-trotting life of bizarre and often allegedly criminal pursuits while embracing the persona of a gun-toting rogue and outlaw, was found dead in his prison cell near Barcelona on June 23. He was 75.

His lawyer Nishay K. Sanan confirmed the death but said he did not know the cause. In a statement that did not mention Mr. McAfee by name, the Catalan justice department announced that an inmate had been found dead in his cell and said that security personnel had been unable to revive him. It appeared to be a suicide, the department said.

Hours before Mr. McAfee’s death, a Spanish court issued a preliminary ruling authorizing his extradition to the United States on tax evasion charges. He had been arrested in Spain in October 2020.

Described as belligerent, attention-seeking and media-savvy, Mr. McAfee was also considered a technology genius. He created high-tech ventures including McAfee Associates, a security-software firm whose product grew into one of the best-selling anti-virus programs.

In the 1980s, as personal computers became mainstream and malware started to emerge, Mr. McAfee, then a successful engineer in Silicon Valley, devised a way to block the Brain virus, considered the first virus to target IBM PCs.

He purposely infected his PC with the virus and then wrote a program to disable the invader. That program became the basis for his company, which he started in 1987 out of his 700-square-foot home in Santa Clara, Calif. Within five years, McAfee Associates controlled nearly 70 percent of the desktop anti-virus market. Half of all Fortune 100 companies were using his software, and Mr. McAfee was making $5 million a year.

With the riches he gained from selling the firm in 1994 — reportedly for $100 million — the self-proclaimed “lover of women, adventure and mystery” commenced a series of exploits that led, by his count, to 21 arrests in 11 countries for alleged crimes involving gun violations, drug trafficking, tax evasion and securities fraud.

Perhaps his strangest odyssey took place in Belize. He had come to the English-speaking Central American country in 2008 to forge a new life after suffering financial setbacks and legal troubles in the United States. Four years later, he became the chief suspect in a murder investigation.

Authorities accused Mr. McAfee of assembling a private army of well-armed ex-convicts and becoming a drug trafficker, charges he denied. He had a reputation for paranoia and allowed his guard dogs to roam free on the beach near his home.

Mr. McAfee’s neighbor, a 52-year-old American expatriate businessman named Gregory Faull, became concerned that the dogs were biting and menacing people and repeatedly complained to their owner, to no avail.

When four of the canines were found poisoned, Mr. McAfee reportedly raged that Faull was to blame. Two days later, on Nov. 11, 2012, Faull was found shot to death in his home.

The police investigation centered on Mr. McAfee, who fled Belize, illegally crossed the border into Guatemala and was arrested after a reporter and photographer inadvertently revealed his hiding spot. Mr. McAfee admitted that as the authorities were preparing to extradite him to Belize, he faked a heart attack and was deported to the United States — a saga that triggered a worldwide media frenzy.

He was never formally charged with Faull’s death, and he explained that his decision to flee was not an admission of guilt, but rather the product of his fear that the gang suppression unit of the Belize police would torture and kill him once they had him in custody. Dean Barrow, then the prime minister of Belize, called Mr. McAfee “bonkers.”

In the years after his departure from Belize, Mr. McAfee became increasingly erratic. In a 2013 YouTube video spoof he made on how to uninstall McAfee software — a program he claimed to have grown to detest, claiming his successors had ruined it — Mr. McAfee is identified as an “eccentric millionaire” and offered an edgy, tongue-in-cheek tutorial while setting money on fire to light his cigarette, snorting fake drugs, swearing profusely and cavorting with nubile young women.

At the end, he declares that he has found the solution to uninstalling the software. He stands, pulls out a pistol and shoots the laptop.

“I’m a madman to some people because I don’t follow the normal rules,” he told ABC News’s “20/20” in 2017. “You know, the drummer that leads me is an odd drummer, but I follow the sound.”

Mr. McAfee boasted about his anomalous sex life, bragging about relationships with sex workers and teenagers. “I gravitate to the world’s outcasts,” he emailed a Wired reporter for a profile published in 2013. “Prostitutes, thieves, the handicapped . . . For some reason I have always been fascinated by these subcultures.”

For years, he had also boasted about his refusal to pay taxes, citing his libertarian belief that it is wrong to force people to do so. He made a quixotic run for the Libertarian Party’s nomination for the U.S. presidency in 2016.

Despite his mounting legal troubles, Mr. McAfee reinvented himself and found a following as a technology pundit and promoter of cryptocurrency, a form of digital money. He presented himself as a cybersecurity guru, warning about the dangers hackers presented, and made paid appearances at conferences and on television.

In March 2019, when a Florida court ordered him to pay $25 million in a wrongful-death lawsuit filed by Faull’s estate, Mr. McAfee announced on Twitter that he would not pay and called the ruling a “legal extortion game aimed at America’s wealthy class.”

That same year, prosecutors in Tennessee — where he was living after returning from Guatemala — accused him of hiding property and other assets from the IRS. Mr. McAfee and his wife Janice quickly boarded their yacht, the Great Mystery, and traveled from port to port in the Caribbean.

After being detained in the Dominican Republic for allegedly carrying high-caliber weapons, ammunition and military-style gear, he hired local lawyers who managed to get him sent to England. By 2020 he had made it to Spain, where he was arrested and jailed while awaiting extradition to the United States.

In March 2021, federal prosecutors in the Southern District of New York indicted Mr. McAfee and his bodyguard, Jimmy Gale Watson Jr., for orchestrating a “pump-and-dump” scheme to bilk cryptocurrency investors out of millions of dollars.

They alleged that Mr. McAfee had bought large amounts of cheap cryptocurrency altcoins and then promoted them on Twitter posts with “false and misleading endorsement tweets” to inflate their market prices. Such was his influence that one tweet to his 1 million followers caused the price of one cryptocurrency to rise in value between 50 and 350 percent. He and Gale allegedly earned up to $23 million that they sought to conceal from authorities.

“I’m the only person in the crypto field that has openly divulged the outrageous amounts of money charged by crypto promoters,” Mr. McAfee told the London Independent in 2018. “It’s embarrassingly huge, but it’s true. I have been getting these fees for over six months.”

John David McAfee was born at a U.S. Army base in Gloucestershire, England, on Sept. 18, 1945. His father, an American soldier, later became a road surveyor, and his British mother worked as a bank teller. When he was 2, the family moved to Salem, Va., where Mr. McAfee, an only child, grew up. He was 15 when his father, whom he said was an abusive drunk, killed himself.

Mr. McAfee received a bachelor’s degree in mathematics from Roanoke College in 1967 and began a career as a programmer. He worked for NASA, Univac and Xerox in software design and operations. He moved to Silicon Valley, where his entrepreneurial spirit, as well as his passion for alcohol and recreational drugs, kicked in.

He told Wired that he had snorted lines of cocaine and downed a bottle of Scotch each day at his desk at an information storage systems company called Omex. An early marriage, to Judith Stump, ended in divorce, and he found himself adrift without a job or friends. He entered Alcoholics Anonymous, later claiming it saved his life.

A significant catalyst to the success of his anti-virus software was his own paranoia-fueled marketing prowess. He railed about the dire threat of computer viruses, sometimes hyping the danger well beyond reality.

When the Michelangelo virus appeared in 1991, he used his growing celebrity to predict doom for the world’s PCs, a tactic that earned him criticism for overstating the threat and scrutiny for fraud. But it also sent McAfee sales skyrocketing, helping his company capture the bulk of the anti-virus software market.

By his own admission, Mr. McAfee was not cut out to run a burgeoning tech start-up.

“The company grew so fast, it was no longer enjoyable,” he told the South China Morning Post in 2013. “When you’re the CEO of a firm that employs 10,000 people, you can no longer do the things that you love, which is programming.” Personnel problems, shareholders and board meetings were “not my cup of tea,” he said.

After selling his company, he built nine homes and bought a fleet of planes and antique cars, as well as a 200-acre parcel of land in Colorado where he set up a yoga retreat. He started two other unsuccessful technology ventures.

He also immersed himself in jet skiing and helped develop a new sport called aerotrekking that involved flying small vehicles at fast speeds close to the ground. A nephew who was working for him took a client out for a lesson and crashed, killing both, which resulted in a $5 million wrongful-death lawsuit filed in 2008 by the client’s family and in which Mr. McAfee was named.

At that time, he claimed the global recession had wiped out much of his fortune, leading him to sell off his properties and leave the country. He later said that it was the lawsuit that drove him to Belize.

In 2013, he married Janice Dyson, whom he reportedly met after hiring her as a prostitute. A complete list of survivors was not immediately available.

“Boy, I do live an exciting life,” Mr. McAfee told the South China Morning Post. “It’s too exciting, sometimes. But that happens if you live on the edge, which I like to do because that’s where most discoveries are made. I’m a curious person, but sometimes I fall off. Like in Belize, I went too far. But this is my life. It’s a true story, and there’s even more to it than even the world knows.”

Harrison Smith and Paulina Villegas contributed to this report.