New Jersey Democrats hit the polls Tuesday holding their nose with one hand as they voted for Bob Menendez for the other.

And many voters and party operatives spent the past 11 months holding their breath.

Now they can exhale, relieved that they avoided a political catastrophe and a painful intra-party reckoning.

A Menendez loss would have forced state and national party leaders to explain why they so swiftly circled their wagons around a damaged incumbent weighed down with the baggage of a tawdry corruption trial and severe scolding by the Senate Ethics Committee, which concluded that Menendez "violated Senate Rules, federal law, and applicable standards of conduct."

Rather than push Menendez aside — and go through the painful, intra-party fight for a next-generation replacement — they stuck on their bet that strong anti-Trump fervor and the party's overwhelming 900,000-voter registration advantage would ultimately carry Menendez to victory over Republican Bob Hugin, the former pharmaceutical executive who poured $30 million of his own money into a failed quest.

And Tuesday night, that forecast proved to be correct.

"It wasn't that Bob won. It was that Trump loses,'' one longtime Democratic operative said, explaining the political climate that favored Menendez.

Local election results:Bergen, Passaic, Morris and Essex unofficial election results

Blue wave?:It carried Menendez, made NJ much more Democratic and it ain't over yet

Menendez's survival does not mean, however, that the New Jersey Democratic Party's machinery will return to a business-as-usual efficiency. The race produced a new crop of party activists furious with Donald Trump's incendiary nationalism and the supine Republican Congress willing to do his bidding.

These Democrats unified in a new "resistance" and proved to a be a sustained, self-regulated army of activists who operated by their own rules and agenda. They are not the kind of Democrats who are normally found at a party nominating convention. If anything, many of them had been unwelcome in the clubhouse.

They vented at town hall protests, organized fundraisers on social media and staged repeated protests. The Westfield office of Leonard Lance, the genteel Republican congressman for the 7th District, became home to weekly sit-ins.

The main focus for those Democratic activists was "flipping'' the House from Republican to Democratic Party control, and they rallied around largely centrist candidates making their first bid for public office in battleground districts. Mikie Sherrill, the 11th District candidate from Montclair, was a federal prosecutor and U.S. Navy helicopter pilot.

Story continues below video

Tom Malinowski, the Democratic challenger in the 7th District, served as an undersecretary in President Barack Obama's State Department.

Andy Kim, the Democratic challenger in South Jersey's 3rd Congressional District, is a Rhodes Scholar and former national security adviser to Obama who moved back to the district to challenge Republican incumbent Tom MacArthur, a wealthy former insurance executive.

Joshua Welle, in the 4th Congressional District, is a 12-year naval veteran who served in Iraq and Afghanistan. Only Jeff Van Drew, a veteran state legislator from Cape May County, climbed his way through the traditional party system.

It is a new grass-roots force that could prove to be a challenge to the party establishment in the coming years. And it is a force largely composed of female voters appalled at Trump, who has lamented the loss of male entitlement and who was elected despite allegations of sexual misconduct.

The new grass-roots activism is also occurring in traditionally Republican districts where the Democrats had only a skeletal political infrastructure. But a surge of Democratic registration over the past decade has given those red districts a purple hue. As a result, activists, spurred by Trump anger, have taken matters into their own hands.

"Two years ago, I took things for granted that things were going in the right direction. The lesson I learned from that: You gotta show up,'' said Jennifer Bryson, who lent the barn on her 11-acre farm in Hillsborough as a staging ground for Malinowski's get-out-the-vote operation.

Story continues below gallery

Yet doubts about Menendez's viability came to the fore in the June primary, when Lisa McCormick, a little-known Union County publisher, garnered 38 percent of the vote — a clear expression of intra-party disgust with Menendez.

And standing in his path for the November race was Bob Hugin, a silver-haired Republican from central casting: a Princeton University graduate and ex-Marine who had the personal means to self-fund his race. And he began an early-summer television barrage that painted Menendez relentlessly as a disgrace, corrupt and inept.

The corruption charge forced the Menendez campaign to keep a lower-than-expected profile. Only a few Menendez lawn signs could be seen in some Democratic strongholds.

At Kim's Burlington County headquarters, for example, the signs were stashed away in a bank vault, available to the occasional supporter who asked for them. Some of the congressional candidates chose to keep their distance even though Menendez was on the top of the ticket. Some suburban activists expressed dismay when Menendez skipped an appearance on "The Brian Lehrer Show,'' a popular WNYC-FM public affairs call-in show. (Hugin appeared as a guest.) And a taped phone message featuring Obama urging Democrats to vote did not mention Menendez.

Yet in the race's final days, a range of prominent Democrats stumped for him, including U.S. Sen. Cory Booker and Gov. Phil Murphy. Hugin proved to be a flawed candidate who could never escape his own past service to the Trump cause. He was a former (and generous) Trump donor and a delegate at the GOP convention in 2016 that anointed Trump as the nominee.

Menendez closed the race as one of the biggest beneficiaries of the anti-Trump fervor. Polls showed Menendez holding a double-digit lead among women — in one poll as much as 20 points — despite a nasty Hugin ad barrage that recycled old, widely debunked allegations that Menendez had engaged in trysts with underage prostitutes in the Dominican Republic.

In a sign of the lingering bitterness, Menendez lashed out at the ad campaign.

"I am so proud that New Jerseyans rejected the politics of personal destruction and the false, negative, salacious ads,'' he said to cheers. "My opponent spent nearly $40 million of his personal fortune trying to convince voters that this election was about me. But what he failed to understand — and you knew all along — that this election was always all about you."

Menendez also omitted making any conciliatory remarks, a customary gesture of election victory speeches.

Kelly Dittmar, an assistant political science professor at Rutgers University-Camden, said Trump forced most Democrats to place party loyalty above any misgivings they have about Menendez.

"The attacks on him and the scandal the surrounds him — at least in the way Hugin tries to paint it — hasn't been sufficient enough for Democrats ... to see Hugin as an alternative,'' said Dittmar, who is also a scholar at the Center for American Women and Politics at Rutgers.

Hugin sought to recast himself as an independent-minded moderate who could be counted on to defy the president, but the suspicion that he would simply become another trusted Trump soldier in the U.S. Senate stuck.

In a late-campaign ad, Hugin said, "I'm often asked, 'Will you stand up to President Trump?' The answer is yes."

Trump, however, apparently wasn't all that bothered. He issued an Election Day endorsement tweet.

The Menendez campaign replied with an ironic "thank you'' tweet. They no longer needed to make the case that Hugin and Trump were fused at the hip. But the "thank you" also took on a wider meaning: Without Trump, Menendez didn't have much of a chance.