The leadership of one of New York’s Five Families, the Lucheses, changed hands thanks to a bloodless coup orchestrated from prison, mob-trial testimony revealed this week.

Imprisoned-for-life Mafia boss Vittorio “Vic” Amuso sent a coded letter from jail to longtime underboss Steven “Stevie Wonder” Crea in 2017. The message: Brooklyn-based Luchese wiseguy Michael “Big Mike” DeSantis was to take the reins of acting boss from Bronx-based Matthew “Matty” Madonna.

If Madonna didn’t step aside, Amuso had a hit list that included a captain and several members of the family, according to John Pennisi, a Luchese turncoat who started cooperating with the feds last year.

“We would have killed members of The Bronx crew,” Pennisi testified at the Manhattan federal court racketeering trial of family soldier Eugene “Boobsie” Castelle.

Pennisi, who was calm and matter of fact on the stand, delivered only glancing blows to Castelle. But in often riveting testimony, he recounted the secret recent history of the Luchese family. The jury heard closing arguments Thursday.

Chief among them was that Madonna, 83, agreed to step aside, averting a blood bath akin to the one Amuso and his then-top lieutenant, Anthony “Gaspipe” Casso, carried out in the late 1980s and early ’90s, when more than a dozen Luchese members were murdered.

New acting boss DeSantis had long ago proved his loyalty to Amuso. He carried out two mob murders for the boss in the late 1980s, and served 18 years in prison.

But it was DeSantis’ failure in an alleged murder plot in 1991 that had the most profound impact on mob prosecutions for decades.

That was the night Big Mike walked stiffly into the Kimberly Hotel in Midtown on a warm September night wearing a heavy blue sweatshirt over a bulletproof vest with a gun in his waistband. Alfonso “Little Al” D’Arco, who was then acting Luchese boss for the fugitives Amuso and Casso, spotted the gun as DeSantis entered a room where a meeting on crime-family businesses was underway. Already alert to rumors Vic and Gas wanted him dead, D’Arco braced himself.

But instead of gunning Little Al down immediately, DeSantis walked into the bathroom, where he stowed the gun in a move reminiscent of the famous scene in “The Godfather.” The delay enabled Little Al to make it safely out of the hotel, into the Witness Security Program, and onto the witness stand for 16 trials, with Amuso being the first of four convicted Mafia bosses against whom he testified.

During the current trial, Pennisi also offered a glimpse into how the Lucheses operate, testifying that there are a total of seven Luchese crews — two in The Bronx, two on Long Island, one in Manhattan, one in New Jersey and Big John Castellucci’s so-called Brooklyn crew. The name is a bit of nostalgia dating back to when both Amuso and Casso were stalwarts of the family’s Brooklyn wing. These days, the crew is actually based in the Tottenville section of Staten Island.

Pennisi said the bloodless coup began when capos started to complain and passed a letter to Amuso in prison. He said it detailed that, in recent years, “the administration of the family had shifted to The Bronx.” At the same time, “there was a crew of guys very loyal to him out here, all Brooklyn guys, [who] wanted to take the family back to Brooklyn. That’s really what this was about.”

Pennisi testified that they received a letter back from Amuso in which “Vic approved” them “taking these [administration] positions in the family,” and that they “were going to have a meeting with Stevie Crea to show him the letter.”

But “in the event that they balked or they wanted to hold their positions,” Pennisi testified, “we would deal with the guys from The Bronx.”

Crea, who had watched Amuso’s suspicions about the family’s Bronx faction result in several murders 30 years ago, peaceably stepped aside along with his ally, Madonna. As a result, Pennisi said, he avoided taking part in numerous murder plots in which he had agreed to participate. Instead, Pennisi said he pursued his own involvement in sports gambling, loan-sharking and assaults during his years as a Luchese associate and then as a made man.

While Pennisi didn’t discuss it on the witness stand, law-enforcement sources say Brooklyn-based mobster Patty Red Dellorusso is the new acting underboss and that Bronx-based wiseguy Andrew DeSimone is the new consigliere.

Not long after the coup, Pennisi said he soured on the Luchese family. In a replay of the defection of Little Al D’Arco years earlier, a series of incidents convinced Pennisi that the Lucheses were wrongly suspecting he was an informer, and had marked him for death.

One day, Pennisi walked into the Manhattan headquarters of the FBI cold and said he needed protection and wanted to cooperate. He said he had spotted two guys parked on the street near his home in Levittown. This, he testified, became “a big, big concern” for him when they turned their faces so he couldn’t see them and one “pulled his baseball cap completely over his face.” He recognized the move as what the mob had taught him to do when he had stalked a target. “Lay on a guy to get his routine down,” said Pennisi.

“That’s the first thing that, in that life, that they do; they want to start getting your routine down, what time you come home, what time you leave, which way you go, you know, they start getting a pattern with you.”

So last Oct. 1, John Pennisi did what Al D’Arco did back on Sept. 21, 1991: He started telling the FBI a story that he knew they’d be interested in hearing.

Jerry Capeci is the founder of ­ganglandnews.com, where this article first appeared.