Democrats take full control of Virginia legislature and claim victory in an upset win in Kentucky.

US Democrats claimed an upset win in Kentucky on Tuesday over a Republican governor backed by President Donald Trump and seized control of the state legislature in Virginia, where anti-Trump sentiment in the suburbs remained a potent force.

The outcomes of Tuesday’s elections in four states, including Mississippi and New Jersey, could offer clues to how next year’s presidential election could unfold when Trump will aim for a second four-year term.

In Kentucky, Democratic Attorney General Andy Beshear, whose father, Steve, was the state’s last Democratic governor, declared a narrow victory over Governor Matt Bevin, who has refused to concede.

Kentucky’s Attorney General Andy Beshear, running for governor against Republican incumbent Matt Bevin, reacts to statewide election results at his watch party in Louisville, Kentucky [Harrison McClary/Reuters]

Bevin cited unspecified “irregularities”. It is unclear what the next step will be. Under state law, Bevin has 30 days from when the results are certified to contest the vote.

Local media quoted the Kentucky governor as saying he “wanted the process to be followed”.

Meanwhile, Trump appeared to accept defeat for the Republican governor but said the election as a whole was a win.

“Won 5 out of 6 elections in Kentucky, including 5 great candidates that I spoke for and introduced last night. @MattBevin picked up at least 15 points in last days, but perhaps not enough,” he said.

In a speech in Lexington, Kentucky, on Monday night, Trump – who won Kentucky by 30 percentage points in 2016 – told voters that they needed to re-elect Bevin, or else pundits would say the president “suffered the greatest defeat in the history of the world”.

The remarks reflected the extent to which Bevin, 52, sought to nationalise the campaign, emphasising his support for Trump amid a Democratic-led impeachment inquiry of the Republican president in Congress.

While the result, if confirmed, would be a significant setback for Trump, who remains relatively popular in Kentucky, it may have had more to do with Bevin’s diminished standing in the state.

Opinion polls showed Bevin may be the least popular governor in the country after he waged high-profile fights with labour unions and teachers.

Beshear’s upset win could also bolster Democrats’ slim hopes of overthrowing Republican Senate Majority Leader Mitch McConnell, who is on the ballot himself in the state next year.

Democrats win big in Virginia

Meanwhile, Democrats wrestled both chambers of Virginia’s legislature from narrow Republican majorities, which would give the party complete control of the state government for the first time in a quarter-century.

Trump has avoided Virginia, where Democrats found success in suburban swing districts in last year’s congressional elections, as they did in states across the country.

Voters walk through a sea of campaign signs at a polling station in Richmond, Virginia [Steve Helber/AP Photo]

Tuesday’s election, which saw Democrats prevail in several northern Virginia suburbs, suggested the trend was continuing.

In Mississippi, where Republican Governor Phil Bryant was barred from running again due to term limits, Republican Lieutenant Governor Tate Reeves defeated Attorney General Jim Hood, a moderate Democrat who favours gun rights and opposes abortion rights.

But even that contest could finish with a single-digit margin in a state Trump won by 28 percentage points three years ago.

Like Bevin, Reeves campaigned as a staunch Trump supporter in a state that Trump easily won in 2016. The president held a campaign rally in the state last week alongside Reeves.

In New Jersey, Democrats were expected to maintain their majority in the state’s general assembly, the legislature’s lower chamber.