Republicans are eyeing a recount and a lawsuit over perceived irregularities in a closely watched US election where the Democratic candidate is claiming victory in a Trump stronghold.

Conor Lamb is clinging to a slender lead in the House of Representatives race in Pennsylvania.

With the last batch of absentee ballots counted, Mr Lamb, a 33-year-old former prosecutor and first-time candidate, saw his edge over Republican Rick Saccone shrink slightly, to 627 votes out of more than 224,000 cast, according to unofficial results.

The four counties in the Pittsburgh-area district reported they had about 375 uncounted provisional, military and overseas ballots.

They have seven days to count the provisional ballots, and the deadline to receive military and overseas ballots is Tuesday.

With the margin so close, supporters of either candidate can ask for a recount.

The Republicans are considering lodging a recount request, and county officials reported receiving a letter from a law firm requesting that they preserve their records, something the counties say they do under state law.

Rick Saccone and his wife  head to cast their ballots in McKeesport (AP/Keith Srakocic)
Rick Saccone and his wife head to cast their ballots in McKeesport (AP/Keith Srakocic)

Separately, Republicans mulled legal action, according to a person familiar with the deliberations.

Complaints could include that party lawyers were prevented from observing the counting of some absentee ballots, voting machines erroneously recorded votes for Mr Lamb, and voters were confused by some information from the state elections website.

Officials in Allegheny County, the most populous and Democratic-leaning county in the district, pushed back on Republican claims, saying the lawyers lacked written authorisation from Republicans and they had received no reports by Tuesday of malfunctioning voting machines.

The race is seen nationally as an indicator of Democratic enthusiasm and Republican vulnerability heading into the November elections that will determine whether Republicans retain their control of Congress.

Mr Lamb has declared victory, but Mr Saccone, a 60-year-old Air Force veteran turned state lawmaker and college instructor, has not conceded. Mr Saccone’s campaign said he had no plans to concede before vote counting was finished.

Mr Trump won the district by about 20 percentage points in 2016, (AP/Alex Gallardo)
Mr Trump won the district by about 20 percentage points in 2016 (AP/Alex Gallardo)

Regardless of the outcome, Mr Lamb’s showing seemed certain to stoke anxiety among Republicans nationwide and renew enthusiasm among Democrats.

President Trump won the district by about 20 percentage points in 2016, and the seat has been in Republican hands for 15 years. It was open now only because Republican Tim Murphy, who espoused strong anti-abortion views, resigned last autumn amid revelations that he had asked a woman with whom he was having an extramarital affair to have an abortion.

Democrats must flip 24 Republican-held seats this autumn to seize control of the House, and months ago few had counted on this district to be in play.

Mr Lamb asserted his independence from national Democratic leaders and played down his opposition to Mr Trump, but he also fully embraced organised labour in a district with influential labour unions and a long history of steel-making and coal-mining, hammering Republican tax cuts as a giveaway to the rich and promising to defend social security, Medicare and pensions.

Mr Trump and his allies invested tremendous time and resources in the seat, mindful the contest could be used to measure his lasting appeal among white working-class voters.