It was a violent end to a violent life.

Less than 12 hours after his transfer to a federal prison in West Virginia, notorious Boston gangster James “Whitey” Bulger was found beaten to death in his cell on October 30, 2018. Authorities believe Bulger’s attackers included a Mafia hitman serving a life sentence who thought the 89-year-old mob boss guilty of an unforgivable crime—being a rat.

For two decades as he ruled Boston’s underworld as its brutal kingpin, Bulger secretly led a double life as an informer for the Federal Bureau of Investigation. In the Irish enclave of South Boston that served as his turf, Bulger let it be known how much he despised snitches and turned down repeated FBI offers to become a confidential informant. That all changed, however, when agent John Connolly approached him in the fall of 1975.

James "Whitey" Bulger's 1953 mugshot. Boston Police/U.S. Marshal Service/New York Times

“Bulger knew that he could manipulate Connolly and have Connolly working for him, and that is indeed what happened,” says Dick Lehr, co-author of Black Mass: Whitey Bulger, the FBI, and a Devil's Deal, which became the basis of a 2015 movie with the same name in which Johnny Depp played Bulger.

Connolly had grown up in the same South Boston housing project as the gangland boss. As an eight-year-old in the 1940s, he met the charismatic 19-year-old Bulger at the corner drugstore. Bulger, called “Whitey” because of his platinum blond hair, offered to buy him an ice cream, which he accepted. A short time later, Bulger saved Connolly as he was being beaten up by an older boy. “Go fight somebody your own size,” the gangster growled, as his young charge stared in awe.

The next time Connolly’s path converged with Bulger’s was after he joined the FBI, in 1968. By this time Whitey had served time in Alcatraz for a bank-robbing spree and ran an illegal gambling and loansharking ring with the local Winter Hill Gang.

James "Whitey'" Bulger's mugshot upon his arrival at the Federal Penitentiary at Alcatraz on November 16, 1959. Donaldson Collection/Michael Ochs Archives/Getty Images

In a secret 1975 meeting inside Connolly’s Plymouth parked at a local beach, the agent asked Bulger to pass along information to help the FBI crack down on the local Italian mob. The agent told the gangster that the Mafia was already giving the FBI information about Bulger’s gang. “Why don’t you use us to do what they’re doing to you?” he asked. “Fight fire with fire.”

On that night inside Connolly’s car, Bulger agreed to moonlight for the FBI—under one condition. “I will not be called an informant. I will be your strategist,” the gangster insisted. After all, there was nothing worse in the underworld than being a rat.

Becoming an informant was a great business move for Bulger. Based on information given by him and his sidekick, Stephen “The Rifleman” Flemmi, the FBI eliminated the competition, the Angiulo crime family, creating a vacuum in the Boston underworld. Bulger quickly filled the void by assuming the racketeering and drug-dealing operations and became New England’s most powerful crime boss.

Bulger’s connection with the FBI also made him less of a target of law enforcement, particularly as he quickly co-opted agents such as Connolly. In addition to giving agents secrets, he gave them gifts and cash as well. According to the Boston Globe, Bulger and Flemmi gave Connolly $235,000 over two decades. Bulger also lavished John Morris, Connolly’s supervisor and the head of the FBI’s organized-crime squad in Boston, with airline tickets and cases of expensive wine. At Christmas, corrupt agents and police officers received envelopes bulging with cash.

“Once he compromised the supervisor, then Whitey was in charge. Instead of doing the right thing, what took hold was a pattern of cover-up,” Lehr says. “By the early 1980s it became about agents covering up their own criminal activity and sustaining their own careers at the bureau.”

Getting tips—which he often embellished the value of— from Bulger was a boon for Connolly’s career. “Connolly was the star agent in the Boston office,” says Lehr. But as “the stakes kept getting higher,” he looked the other way when it came to Bulger’s crimes.

Former FBI agent John Connolly surrounded by photographers as he leaves Boston Federal Court, facing charges in his involvement with mobsters Whitey Bulger. John Tlumacki/The Boston Globe/Getty Images

Despite his known involvement in serious crimes, Bulger received protection from the corrupt FBI agents. He was excluded from indictments against members of the Winter Hill Gang, and he engaged in criminal activity with greater impunity.

More and more, Connolly became the actual informer, and even told Bulger about people expected to testify against him. Acting on a tip from the FBI agent, Bulger lured suspected informers to a house in South Boston, chained them to a chair for interrogation, shot them in the head and buried them in the basement.

In 1994, Connolly gave Bulger advance warning that state and federal law enforcement officers were poised to arrest him. The crime boss fled Boston in advance of a January 1995 racketeering indictment and became Public Enemy Number One after the killing of Osama bin Laden.

While his informer was on the run, Connolly was sentenced to 40 years in prison. “We got 42 stone criminals by giving up two stone criminals,” Connolly told the Boston Globe in defense of his relationship with Bulger. “What’s your return on investment there? Show me a businessman who wouldn’t do that.”

For nearly two decades, “Where’s Whitey?” was a commonly asked question around Boston. Reported sightings came in from around the world until his 2011 capture in a rent-controlled apartment blocks from the Pacific Ocean in Santa Monica, California, where he lived with his long-time girlfriend.

Two years later, a jury found Bulger guilty of participating in 11 murders, and he was imprisoned with two life sentences. During the trial, Bulger acknowledged his involvement with racketeering, gambling, loansharking and drug dealing—but never of being an informer.

“I was the guy that did the directing. They didn’t direct me,” he said in a CNN documentary after his trial.

Lehr disputes this. “There’s no question that Bulger provided information, but I do believe in his own mind to rationalize it he talked about it as a business decision.”

Bulger may have convinced himself he wasn’t an informer, but many in the underworld saw it differently, apparently including the men who killed him. According to some news reports, the attackers gouged out Bulger’s eyes and attempted to cut out his tongue—a retribution often delivered by mob killers to suspected rats.

READ MORE: When a Mob Boss Out for a Steak Dinner Was Murdered in Cold Blood