CANONSBURG, Pa. — Rick Saccone was on the cusp Tuesday night of being the first Republican to lose a competitive House race in the President Trump era, as the Western Pennsylvania lawmaker narrowly trailed Democrat Conor Lamb in a special election in the Eighteenth Congressional District.

But Saccone was holding on to see whether absentee, military and provisional ballots could deliver him a come-from-behind win while also weighing recount options. Lamb was ahead with 49.8 percent of the vote to Saccone's 49.6 percent, a lead of just 579 votes.

"This race is too close to call and we’re ready to ensure that every legal vote is counted. Once they are, we’re confident Rick Saccone will be the newest Republican member of Congress," said National Republican Congressional Committee communications director Matt Gorman in a statement.

"The NRCC is proud of our efforts in this race to promote Rick’s message, motivate Republican voters, and hold Conor Lamb accountable," Gorman added.

Democrats were already celebrating, however. “These results should terrify Republicans," Democratic Congressional Campaign Committee chairman Ben Ray Lujan said in a statement. "Despite their home field advantage and the millions of dollars outside groups poured into this race, Republicans found that their attacks against Conor, including their unpopular tax scam, were not believable."

Lamb also declared victory when he addressed supporters after midnight. "It took a little longer than we thought, but we did it," he said to applause.

It was a race defined nationally as a must-win for Republicans because of the support the district gave Trump just 16 months ago. Many experts questioned the GOP’s candidate choice, messaging, ground game, and ability to hold onto the congressional majority days before the first ballot was cast.

“This is the model of how Democrats win,” said Rep. Mike Doyle, D-Pa.

Saccone fell behind Lamb in a district that went for Trump by 20 percentage points in 2016, and Democrats did not even bother to field a candidate to run against disgraced former Republican Rep. Tim Murphy that year.

Murphy, a staunch pro-life Republican, resigned in October after it was revealed during the course of an extramarital affair he urged his mistress Shannon Edwards to have an abortion during a pregnancy scare.

Edwards has declared she is entering the primary for the newly-drawn Fourteenth Congressional District as a Republican. All 18 of Pennsylvania’s congressional districts were redrawn earlier this month after the Pennsylvania Supreme Court declared them unconstitutional.

Saccone was buoyed by visits by nearly the entire Trump family. Daughter Ivanka held a small business panel with Small Business Administrator Linda McMahon in Mt. Lebanon. The president held a packed rally last Saturday in Moon Township. Donald Trump Jr. toured a candy factory in Canonsburg Monday afternoon. But the Republican never caught up to Trump's level of support from the presidential campaign.

By contrast Lamb, a young, affable, military veteran and former federal prosecutor, was able to define himself in midstride as an independent warrior who would take on both parties once he reached Washington.

He was careful not to criticize Trump, supported the steel and aluminum tariffs, said he was for middle-class tax cuts, remained pro-Second Amendment, and barely mentioned that he was running as a Democrat.

Lamb’s charm, relative moderation, and ability to attack House Minority Leader Nancy Pelosi before Saccone did, combined with the Republican’s vulnerability with union household support for his stances on right-to-work, turned this race into a prime Democratic pickup opportunity.

“What a great honor, I am so proud of my son,” said Tom Lamb, Conor’s father.

The lesson for Democrats is to pick candidates who fit their district. Lamb did not have to face a raucous primary process that would have pushed him further. In the redrawn congressional district, will not have that luxury. Lamb already has to face a primary in May against progressive Democratic rivals.

Local Democrats calculate that Lamb will ultimately decide to run in the new Seventeenth Congressional District, which would have him face off against incumbent Republican Rep. Keith Rothfus, whose seat was moved from the Twelfth District, under the new redistricting scheme.

“We have to go out and talk to everyone, ask for their vote and talk jobs. Period.” said Allegheny County Executive Rich Fitzgerald, a city of Pittsburgh Democrat.

The lesson for Republicans is tougher. Establishment Republicans have not yet figured out how to run and win, because they have not quite pinpointed where their base is. Since 2010, GOP voters have become increasingly populist, while still retaining core tenants of conservatism. Republicans have spent eight years running against power. Now that they have power, they need to develop a better message and reason to draw voters out to support them.

And they have certainly not figured out how to run with Trump, a unique figure that candidates often find themselves both repulsed and pleased by simultaneously.

While Republicans had a solid ground game, with scores of paid staff and volunteers on the ground door-knocking ahead of the race and getting voters out on election day, the ads were flat and ineffective, despite millions of dollars spent. Nevertheless, Republicans remain hopeful of an upset while Democrats see positive signs for the midterm elections.

“We can win in these districts, Lamb proves that, the question becomes, 'Do we pick them in our primary contests?'” said Dane Strother, a Washington-based Democratic strategist.

“This is going to be a tough year for them, if they can’t figure that out that impacts fundraising and enthusiasm,” Strother said of Republicans.

Youngstown State University political science professor Paul Sracic wonders how memorable this race will really be. “Frankly, come November, I doubt we will even remember this race,” he said. “If it tells us anything, it may be what an incredibly weak candidate Hillary Clinton was in 2016. Why? Well, if this really was a Republican plus 20 district, I doubt Saccone would have fared so poorly.”

The Trump coalition had three parts: social conservatives, working class voters, and traditional Republican economic conservatives, explained Sracic.

“Within that coalition, it was actually the traditional, Mitt Romney type Republicans who were the weakest link. These are exactly the types of voters who are in the Eighteenth Congressional District in Pennsylvania, and you can make the argument that Trump is losing them, at least when they have the choice of a candidate like Lamb,” he said.

“I doubt that the Trump rally made a big difference for those voters," Sracic added. "It is more likely that Trump was able to energize the working class and social conservative parts of his coalition, and that is why the race closed in the end."

Regardless of the ultimate outcome, the race gave Democrats hope they could compete in a wide range of districts in 2018.

“The results tonight show that Democrats can compete and win in districts like these if they nominate candidates that reflect the district and focus their campaigns on local and pocketbook issues,” said Mike Mikus, a western Pennsylvania Democratic strategist.

Voters can file petitions for a recount within five days once the race is finally called.