The neck-and-neck result in Tuesday’s special congressional election in a reliably Republican Pennsylvania district revealed that the appetite for President Trump’s style of politics may have its limits in the land of shuttered steel mills and coal mines that has been the core of his support base.

The president went all in for Republican candidate Rick Saccone, a seemingly safe bet in a district Trump had carried by 20 percentage points in 2016.

Trump visited there twice in recent weeks. He dispatched his eldest son. He sent top White House aides. Yet, with all that political capital on the line, the president watched his favored candidate finish, in effect, in a tie in what should have been an easy win.

The razor-thin vote count — three months after Democrats picked up a U.S. Senate seat in deeply conservative Alabama and coming on a whirlwind day when Trump tried to wrangle control of his administration by ousting his secretary of state — left Republicans feeling jittery just months ahead of the midterm elections.

Democrat Conor Lamb declared victory on March 14 in a U.S. House special election in Pennsylvania, but Republican Rick Saccone said “it’s not over yet.” (The Washington Post)

And, with Democrat Conor Lamb coming close to a once unthinkable victory, other Democrats running this fall in Trump-friendly districts may find a formula to boost their hopes of retaking the House.

“We should be able to elect a box of hammers in this district. If we’re losing here, you can bet there is a Democratic wave coming,” said veteran Republican consultant Mike Murphy, a Trump critic.

Uncertainty now pervades the party that Trump leads.

Tuesday’s effective tie, coming in the aftermath of Trump’s ­aggressive push for steel and aluminum tariffs that were backed by both Pennsylvania candidates, suggests the power of the president’s hard-line trade stance to rally his voters is no longer a given.

The failure to secure an outright win also adds to an aura of negativity surrounding the president. Political storms accumulate seemingly by the hour, from the exit of mainstream figures inside the West Wing to the drip-drip developments in the Russia investigation to new revelations in the saga of a $130,000 hush agreement between a porn star and the president’s personal ­lawyer.

Lamb’s vote total wasn’t a sporadic burst of liberal energy in a blue state where faded Obama stickers still cover bumpers and the Trump resistance thrives. It was a sign of weakness in the beating heart of Trump’s political base — a place where red “Make America Great Again” caps were worn proudly throughout the last presidential campaign and where passion for the economic protectionism that Trump has made his creed rivals the passion for the Pittsburgh Steelers.

But Lamb, a 33-year-old ­retired Marine and attorney with a chiseled jaw and centrist pitch, was able to peel away voters from Saccone, 60, a Republican state lawmaker, in Pennsylvania’s 18th Congressional District.

Trump’s tariff plan, his raucous rally in the district over the weekend, the Republican-authored tax law, the blizzard of television ads from conservative groups linking Lamb to House Minority Leader Nancy Pelosi (D-Calif.), and the visit by Donald Trump Jr. to a candy-making facility on Monday — none of it was enough to secure a victory Tuesday night for Saccone, whom Republican and White House officials have snidely described as “Mr. Generic ­Republican.”

To Trump allies, the poor showing Tuesday was not a reflection on the president, but instead a reminder that the GOP should be embracing candidates who emulate the unscripted former reality TV star in the Oval Office.

“You can’t run a standard campaign,” former Trump campaign adviser Ed Brookover vented. “These kind of regular, Republican establishment campaigns, running as a conservative, isn’t going to work.”

The potential breakdown could be a rupture point in the Trump-Republican relationship that has so far held together.

For months, congressional Republicans have looked on uneasily as the White House has erupted with tensions and as Trump has fumed at foes and friends on Twitter and elsewhere. They have worried that the president and their party seemed alarmingly adrift, lurching between one policy fight or personnel drama to another without much legislating or political command.

Nevertheless, most Republicans have hesitated to worry too much, at least publicly, since the president appeared in polls to have a solid grip on his core voters in areas like Pittsburgh’s southern suburbs — the voters Republicans are counting on to turn out in droves this fall and stave off a Democratic takeover. He had overseen the confirmation of Supreme Court Justice Neil M. Gorsuch and signed the sweeping tax law that they had craved, which reassured them along the way.

It was a bargain between Republicans and an unconventional president to move forward arm-in-arm toward the November elections, even if both sides knew the relationship was fraught. Trump may have been vexing, but he was necessary for the party’s chances. Saccone, who wrapped himself politically around Trump in the Pennsylvania contest, was a case study in the survival strategy.

That bargain began to fray as the returns came in Tuesday night and the race in that overwhelmingly GOP district grew tight. Republicans watched with concern — in between frenzied cable-news updates on Secretary of State Rex Tillerson’s volatile departure — as it became clear that a Democrat was holding his own in the middle of Trump country.

While Republicans still feel steady about much of their argument to voters this fall — the stock market has made gains amid various bumps over the past year and the latest jobs report was strong — they no longer have confidence that the tax cut and the state of the economy alone can lift them to victory if Trump’s political brand is eroding in the places that had been rock solid.

And if Trump is no longer able to be counted on to yank a Republican to victory in this corner of Pennsylvania, where will he? In the coming months, some Republican strategists say they expect vulnerable GOP candidates to figure out how to define their candidacies in local and personal terms.

“Everybody will run for their district. They won’t necessarily run away from Trump but emphasize the parts of the Trump presidency that have been wins for the whole party — taxes, regulatory reform, those kind of issues rather than defending every piece of it,” said former Pennsylvania congressman Bob Walker (R).

Democrats, meanwhile, after stumbling in several elections last year and seeing anti-Trump liberals dominate their ranks, found themselves rallying behind Lamb, a polished and decidedly centrist candidate who said he is personally opposed to abortion and averse to aspects of gun ­control.

Lamb often echoed Trump’s views on trade, in effect stealing back an issue that Democrats have used for decades to rally working-class voters. He raised more money than Saccone and deftly handled questions about Pelosi, promising to oppose her in a leadership race. He associated with Democrats like former vice president Joe Biden, who campaigned in the district.

“It’s that old, western Pennsylvania conservative Democrat that Lamb was able to bring back,” said Patrick Caddell, a longtime Democratic pollster.