Gov. Cuomo’s new commitment to Democratic control of the state Senate after years of backing Republicans is a direct result of Donald Trump’s sinking presidential campaign and the possibility it will take GOP senators down with it, senior Democrats told The Post.

They also said Cuomo’s new stance — outlined in a private meeting with Senate Democrats earlier this month — results from his fear that anything short of genuine support for fellow Democrats this year could blow up in his face in the form of a primary campaign against him in 2018 if, as expected, he seeks a third term.

That fear could turn into a nightmare, the Democrats agreed, if Mayor de Blasio, who Cuomo hopes will be defeated in next year’s Democratic primary, is victorious and decides to back a primary challenger against him.

“If Cuomo fails in his effort to get rid of de Blasio, you can be sure de Blasio will reciprocate by trying to get rid of Cuomo, and a re-elected de Blasio will have plenty of juice to do that,’’ said one of the state’s best-known Democrats, who has been associated with Cuomo for many years.

Two senior Democrats said Cuomo — who was faulted just a few weeks ago at the Democratic convention in Philadelphia for failing to join other top elected officials in publicly backing a Democratic Senate takeover — has come to realize he was making a primary challenge to his re-election more likely.

“This is all about what Cuomo needs, and what Cuomo needs is to make sure he doesn’t hand a high-profile [primary] opponent a winning issue on a silver platter, which is what his failure to help Democrats this time would be,’’ said a source who has worked closely at times with the governor.

Another prominent Democrat said private polling data showing Trump’s support in New York state sharply declining over the past two weeks convinced Cuomo “that the Democrats have a good chance to take the Senate anyway, so he might as well get on board.’’

“The polls indicate that several Long Island Republicans may be swept out to sea because of Trump’s unpopularity,’’ the Democrat continued, naming Sens. Kemp Hannon and Carl Marcellino (R-Nassau) as being especially vulnerable.

Republicans currently fill 31 of the Senate’s 63 seats, but they’re holding on to the majority with the aid of Democratic Sen. Simcha Felder of Brooklyn.

PoliticoNY revealed last week that Cuomo hosted a “minisummit’’ with leading Democratic senators at the Harvard Club in Midtown to discuss campaign strategies for November.

While Senate Democrats came away from the session hopeful, they also remain highly skeptical.

Sen. Michael Gianaris of Queens, head of the Senate Democratic Campaign Committee and a key figure at the summit, described the meeting in terms more suited to peace talks between enemies than to a strategy session among allies.

“Our meeting with the governor involved a productive discussion of the upcoming elections and ways we can work together,’’ Gianaris said cautiously.

“We look forward to continued cooperation in the coming months, as well as in 2017, with a functioning Democratic majority.’’

Cuomo press secretary Richard Azzopardi said, “We support Democrats,’’ when asked about the summit, but he refused to say what transpired, insisting, “We don’t comment on private meetings.’’

Many Democrats believe that Cuomo, who is widely disliked in high-level party circles, could be beaten in the 2018 primary by a more popular vote-getter than Zephyr Teachout, the little-known and virtually unfunded leftist Fordham law professor who received a remarkable 34 percent against the governor in 2014.

Attorney General Eric Schneiderman, a longtime Cuomo nemesis who appears to have recently made peace with the governor, and state Comptroller Tom DiNapoli, with whom Cuomo has battled for months, are those most often mentioned, but other challengers are possible, insiders say.

“A well-known and well-liked progressive with a lot of money and union support could beat him. After all, look how well Teachout did,’’ said a longtime Democratic union strategist.