Blood-thirsty Boston gangster James “Whitey” Bulger, who ran lucrative criminal rackets for decades under the protection of crooked FBI agents, was killed shortly after his transfer to a West Virginia prison late Monday, law-enforcement sources told The Post.

Bulger, 89, was found unresponsive inside the maximum-security Hazelton federal penitentiary in Bruceton Mills, the Bureau of Prisons said Tuesday.

The BOP didn’t disclose the cause of death, but a law-enforcement source said Bulger was “badly beaten” by more than one inmate shortly after he arrived at Hazelton on Monday.

At least one of the attackers used a sock with a padlock inside it to batter Bulger’s face and head, the source said.

Authorities are investigating whether Bulger was killed as “some sort of mob retribution” for his years of secretly serving as an FBI informant while also running Boston’s vicious Winter Hill Gang from the 1970s through ’90s.

That sneaky maneuver, which Bulger fueled by bribing corrupt agents, allowed him to avoid prosecution while also helping the feds eliminate his criminal competition.

The BOP Web site shows that Hazelton’s inmates include Boston mob associate Paul Weadick, 63.

In June, Weadick and mob boss Francis “Cadillac Frank” Salemme were convicted of murdering a Boston nightclub owner in 1993 to keep him from cooperating with the feds.

The witnesses against them included Bulger’s former partner-in-crime, Stephen “The Rifleman” Flemmi, and a source said the mob “has been after Bulger and Flemmi for years.”

“They think Bulger ratted out where Salemme was when he was arrested,” the source said.

“Weadick is already doing life, he has nothing to lose.”

Bulger — who inspired Jack Nicholson’s character in the Oscar-winning movie “The Departed” — went on the run in 1995 after getting tipped that he was about to be arrested.

He spent 16 years as a fugitive — and even replaced Osama Bin Laden as the nation’s “most wanted” outlaw — before getting busted in California in 2011, based on information from a former Miss Iceland who recognized him in a news report.

In 2013, he was convicted of dozens of felonies, including participating in 11 murders, and sentenced to two life terms plus five years by a judge who told him that the “scope, callousness and depravity of your crimes are almost unfathomable.”

But he beat the rap on eight more killings, including that of Flemmi’s ex-girlfriend Debra Davis, who Flemmi testified was strangled by Bulger in 1981 because she knew too much about him and the FBI.

“With it being Halloween, I didn’t know if it was a trick or a treat,” Davis’ brother, Steven Davis, told The Post upon hearing of Bulger’s death.

“I’m thrilled. I hope it was a brutal murder. I hope he suffered more than anyone he laid a hand on.”

The son of victim Michael Donahue, who was innocently giving turncoat gang member Michael Halloran a ride home when Bulger shot and killed them both in 1982, said his family can “finally put him behind us.”

“He will be getting a pitchfork in the ass from the devil now,” Tommy Donahue told the Boston Herald.

Widow Patricia Donohue, 73, said, “When I heard that he had gotten murdered, I thought: Well, you live that life, you die that life.

“I don’t know if it’s actually justice, but the fact that we don’t have to hear his name anymore is some sort of closure for myself and my family,” she added.

Former Boston Globe reporter Dick Lehr, who co-wrote two books on Bulger — including “Black Mass,” which was made into a 2015 movie starring Johnny Depp as Whitey — said Bulger had been a marked man since the paper revealed in 1988 that he was an FBI informant.

“I guess elephants and the Mafia never forget,” said Lehr, now a Boston University professor.

“Here in Boston, there are all kinds of people from all walks of life who would want to see him dead — or are not shedding a tear over his passing.”

A ninth-grade dropout, Bulger embarked on a life of crime even while doing good deeds such as driving older women home from shopping and carrying their bags into the South Boston housing project where his family lived.

In 1955, he helped rob three banks and was sentenced to 20 years in federal prison after ratting out his accomplices and pleading guilty.

While locked up in Atlanta, he volunteered to be part of an LSD experiment that caused him to suffer nightmares the rest of his life, and he was later sent to the infamous

Alcatraz prison for his involvement in two escape plots.

He was paroled in 1965 and quickly picked up where he left off, working as a criminal enforcer in South Boston before joining the Winter Hill Gang.

In 1975, he became an informant for FBI agent John Connolly, who grew up in the same housing project and was a protege of his brother, William Bulger, who rose to become president of the Massachusetts state senate.

Bulger and Flemmi, who was already an FBI informant, helped Connolly decimate the Mafia’s Boston operations, which in turn made them the city’s most powerful criminals.

But the corrupt deal — which included $235,000 in payoffs to Connolly over 20 years, and another $7,000 in bribes to Connolly’s supervisor, John Morris — eventually unraveled due to an investigation by the State Police and the DEA.

Tipped off by Connolly, Bulger fled in January 1995 with one of his two longtime girlfriends, Teresa Stanley, until she decided to go home and his other girlfriend, Catherine Greig, took her spot.

In late 1996, the couple settled into an apartment near the beach in Santa Monica, Calif.

Connolly, in 2002, was convicted of racketeering and served 10 years in a federal prison.

Connolly was again convicted in 2008 of helping Bulger’s gang murder gambling executive John Callahan, whose bullet-riddled body was found in the trunk of his Cadillac at Miami International Airport in 1982.

The ex-FBI agent was sentenced to 40 years in Florida prison for that crime, and won’t be eligible for parole until 2039, at which point he would be 98.

Bulger and Greig managed to evade the law until neighbor Anna Bjornsdottir, an actress who was Miss Iceland 1974, recognized Bulger in a news report while visiting her native country.

She turned him in and collected the record $2 million bounty the FBI had put on his head.

Greig pleaded guilty in 2012 to conspiracy to harbor a fugitive, and was sentenced to eight years in prison, with 21 months added in 2016 when she refused to tell a grand jury if anyone had helped her and Bulger on the lam.

Bulger didn’t testify at his eight-week trial, but at one point got into a profanity-laced exchange with his former right-hand, Kevin Weeks, who’d testified that Bulger and Flemmi were “the biggest rats.”

Two years later, he admitted remorse in a letter to three high school girls who wrote to him in prison as part of a history project.

“My life was wasted and spent foolishly, brought shame + suffering on my parents and siblings and will end soon,” Bulger wrote.

“Advice is a cheap commodity some seek it from me about crime — I know only one thing for sure — If you want to make crime pay — ‘Go to Law School.’ “