A legal threat from investor Mario Gabelli was a “major factor” in this week’s implosion of Shari Redstone’s $8 billion deal to merge Paramount Global with its “Mission: Impossible” production partner Skydance Media, The Post has learned.

When Redstone made a surprise move to pull the plug on the deal this week — just before a Paramount special committee was poised to vote on it — she was looking down the barrel of a $100 million-plus lawsuit from Gabelli over the deal, according to sources close to the situation.

The 70-year-old media heiress hadn’t been in any recent discussions with Gabelli, who has long been a key Paramount investor, sources close to the situation said.

Nevertheless, other Paramount shareholders had ripped Redstone for seeking a premium for her stock over other that of other Paramount investors.

A rep for Redstone didn’t immediately respond to a request for comment.

In an exclusive interview with The Post, the 81-year-old billionaire — a self-described “Bronx tough guy” long famous for his savvy media investments — declined to discuss any specifics around prospective litigation over Paramount.

But he also didn’t deny it may have been in the cards.

“Like Teddy Roosevelt said, I speak softly and carry a big stick,” Gabelli said. “We have established a relationship with an attorney and are looking at all of this under a microscope.”

Redstone — daughter of the late media mogul Sumner Redstone — controls Paramount through her 77% stake in National Amusements, a holding company that controls Paramount’s voting shares.

Gabelli, meanwhile, owns more than half of the remaining voting shares — 54% to be exact, according to securities filings.

In addition to Skydance recently slashing its proposed payment for National Amusements to $1.7 billion from more than $2 billion, sources say a sticking point in talks was whether Skydance would indemnify Redstone against potential litigation in the event she didn’t seek shareholder approval for the deal.

Indeed, sources say Gabelli’s legal team was focused on National Amusements — leaving Redstone herself with the lion’s share of the liability.

Redstone’s lawyer reportedly emailed the Paramount special committee Tuesday saying it and Skydance could not agree on outstanding noneconomic terms. Insiders say legal liabilities around the shareholder vote were a major issue.

“People look at Gabelli as an activist and litigator,” said one Wall Street analyst who covers Paramount’s stock.

“Shari and the Paramount special committee know damn well how the vote would have gone if there was an independent vote,” the analyst added.

It wouldn’t be the first time Gabelli extracted his fair share from Redstone in court.

In April last year, shareholders including Gabelli won a $122.5 million settlement over Viacom’s $30 billion merger with CBS — the deal that formed Paramount Global.

Gabelli had griped that Redstone and a Viacom special committee breached their fiduciary duty when they okayed the deal without shareholder approval.

Sources say Gabelli believes the Skydance deal was even worse, given the rich premium Redstone was seeking for her stock.

Insiders say Redstone feared Gabelli’s wrath despite the fact that the voting and common stock would have been consolidated in a shareholder vote on a Skydance merger, curbing Gabelli’s influence.

Now, Redstone is reportedly exploring a sale of National Amusements to bidders including Edgar Bronfman Jr. rather than selling all of Paramount.

“One possible theory of what’s going on is if she cuts a deal to sell part of National Amusements, there is no litigation,” Gabelli said.

That’s not necessarily a safe bet, either. According to sources, Bronfman is weighing a plan to split Paramount Global’s streaming business from its low-growth cable channels, saddling the latter with the company’s debt.

Technically, Redstone wouldn’t need shareholder approval for a National Amusements sale.

But if a buyer then moved to make changes at Paramount Global, it could trigger shareholder objections over change of control provisions, sources said.

“If she attempts to sell NAI, we have six months to figure out if it is a change of control while the FCC examines the deal,” Gabelli said.

In an exclusive April interview with The Post, Gabelli said he’d rather see no sale.

Despite fears over the media giant’s debt load, malaise at movie theaters and cable TV cord-cutting, Gabelli said he likes its prospects as it slashes costs and grows its Paramount+ streaming service.

That’s a position he reiterated this week.

Gabelli said he believes the streaming business including Paramount+ will surge in value to $19 billion in 2027 from $13 billion this year.

The film business, he projects, also will more than double in value from $830 million to $1.7 billion in three years.

“We’re marathon runners and looking at Paramount from a long-term ownership position,” Gabelli told The Post.