Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

WASHINGTON — Trumpism took a beating.

Now, President Donald Trump, former White House strategist Steve Bannon and their allies are racing to rescue it from the ashes of Republican Ed Gillespie's resounding defeat in Tuesday's Virginia gubernatorial election and GOP losses in dozens of down-ballot contests across several states.

They contend that Virginia voters spurned a consummate Washington insider — not the president's brand of politics — even though a massive turnout surge in Democratic strongholds suggests there was little Gillespie could have done to overcome the anti-Trump wave.

"Republican Swamp Thing Gillespie Rejected," Bannon's Breitbart News declared in a headline.

Gillespie "did not embrace me or what I stand for," Trump tweeted from Asia.

The rush to destroy Gillespie — who borrowed some tactics from Trump but kept his distance from the president — points to an escalating fight within the party over whether candidates are better off courting Trump and his loyal base or keeping them at arm's length. After Gillespie failed to strike a balance between the two, he took criticism for it.

During his failed senatorial campaign @EdWGillespie played footsie with conservative populism but didn't embrace it. Big mistake. — Laura Ingraham (@IngrahamAngle) November 8, 2017

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

On the other side of the GOP divide, John Weaver, a longtime aide to Ohio Gov. John Kasich, wrote on Twitter that the party should treat the president like dead tissue.

"I'm not gleeful about GOP losing elections. But if you have gangrene in your leg (Trump), chop the sucker off. But 2018 is looming & that is a big chop. #WakeUpGOP," Weaver said.

The battle will only intensify in the coming months, as GOP lawmakers set their own strategies for the 2018 midterm elections — or choose not to run at all.

"Like animals sensing the earthquake before it hits, members of Congress are finely attuned to potential political waves," said Doug Heye, a GOP strategist and former congressional aide who, along with others, is predicting more Republicans will announce soon that they won't seek re-election.

Related: Democrats Drub Republicans Across the Country

For many Republicans, the big lesson of Tuesday's wipeout is that it's toxic to be tied to Trump in politically competitive parts of the country.

The Trump wing of the party, however, sees the same set of facts from the opposite angle: With Democrats energized in opposition to the president, they say, the only way for Republicans to win is to drive their base to the polls. And that requires strict adherence to Trumpism.

"It is still true that a depressed base does not bode well for midterm elections, which are all about base voter turnout," said Jenny Beth Martin, co-founder of the Tea Party Patriots. "I still recommend that the Republicans keep their promises to voters so their base has a reason to be supportive next year."

Gov.-elect Ralph Northam, center, links arms with, from left, current Gov. Terry McAuliffe, Lt. Gov.-elect Justin Fairfax, Attorney General-elect Mark Herring, and U.S. Sen. Mark Warner (D-VA) at an election night rally on Nov. 7 in Fairfax, Virginia. Win McNamee / Getty Images

Martin, like other Trump backers who spoke to NBC News, said that the outcome in Virginia shouldn't be over-interpreted in terms of the national political mood. There are unique factors in the state, not least of which is resistance to Trump's "drain the swamp" mantra in Washington suburbs where many residents make their living from the federal government or the industries that surround it.

David Bozell, president of the conservative group For America, said Republicans in Congress have to execute on Trump's agenda so they have something to run on in the midterms. Otherwise, he said, they'll have difficulty formulating a message that resonates with GOP voters.

Gillespie was uninspiring, said Bozell, who added that he might not have voted if his polling location wasn't "on my way home from work."

Republicans are concerned now. And for good reason.

Gillespie actually got roughly 160,000 more votes than 2013 Republican governor nominee Ken Cuccinelli. The problem for the GOP: Democrat Ralph Northam out-performed that year's winner, Democrat Terry McAuliffe, by about 335,000 votes.

"The other side is more motivated by anger than our side is motivated by hope at the moment," Cuccinelli said Tuesday night.