Democrat Andy Beshear claimed victory in Kentucky’s governor vote, after a tight race in the conservative-leaning state.

Meanwhile, Democrats seized full control of the legislature in Virginia for the first time in over 20 years.

The results are being viewed as a gauge of the political mood ahead of next year’s presidential election.

However, Republicans held on to power in the Mississippi governor vote, following a closely-fought race in the traditional Republican stronghold.

US state governors head the executive branch in state governments.

In Kentucky, Mr Beshear claimed victory over incumbent Republican governor Matt Bevin after final results gave him a lead of 0.4%.

Mr Bevin, 52, says he will not concede, citing unspecified “irregularities”.

However, Mr Beshear, a 41-year-old attorney general whose father was a former governor of the state, said: “We will be ready for that first day in office and I look forward to it.”

The loss will be seen as a setback for Mr Trump, who attempted to galvanise support for Mr Bevin at a campaign rally in Kentucky on Monday night.

In a speech to thousands of supporters, Mr Trump said a loss for Mr Bevin would be characterised as “the greatest defeat in the history of the world” by his critics.

Mr Beshear, he said, was “too extreme and too dangerous” to govern the state.

However polls showed Mr Bevin was one of the least popular governors in the country, following high-profile battles with unions and teachers.

Despite losing the governor’s race, Republican candidates claimed victory in five other votes in Kentucky, including a poll for the state’s attorney general.

The southern state voted overwhelmingly for Donald Trump in the 2016 presidential race, giving him a nearly 30% margin over Hillary Clinton – the highest winning margin of any Republican presidential candidate in Kentucky in over 40 years.

Meanwhile, in Virginia, the Democrats overturned Republican majorities in both chambers of the state legislature.

The elections of Danica Roem, the first openly transgender person to serve in the House, and Ghazala Hashmi, who will be the first Muslim woman in the Senate, were among the Democrats’ notable victories in the state.

Virginia also saw Juli Briskman – who gained US media attention in 2017 after she lost her job for making an abscene gesture at Mr Trump’s motorcade¬†¬†– elected as a district representative in Loudoun County.

Ahead of the vote, Democratic presidential hopefuls – including frontrunners Joe Biden and Elizabeth Warren – had campaigned with local candidates.

With full control of the state legislature, Virginia Democrats are expected to push for tighter gun-control, health insurance reform and other policies opposed by Republicans.

Republican Matt Bevin was a Donald Trump-style candidate a year before Donald Trump won the presidency.

Once in office, Bevin governed a lot like Trump, as well. Despite sinking popularity in opinion polls, he contended that he would win comfortable re-election.

He didn’t. Bevin’s strength in the rural parts of the state weren’t enough to overcome Beshear’s margins in the cities and – of particular concern to Republicans – the kind of suburban areas that also were key to many Democratic wins in 2018.

Trump himself threw his support behind Bevin in the campaign’s closing days, holding a rally in Louisville on Monday and warning that a Bevin loss could bolster the forces pushing for his impeachment.

Republicans did well in other Kentucky races and Bevin’s loss may be by the narrowest of margins, but it will be cited as evidence of Trump’s weakened political muscle.

Although the presidential election is more than a year away, Tuesday’s results are being seen as a reflection of Mr Trump’s popularity among voters as he faces an impeachment inquiry.

Reacting to the results on Twitter, Mr Trump hailed the performance of Republicans in Kentucky and Mississippi.

He congratulated Tate Reeves, who defeated Democrat Jim Hood to extend the Republican Party’s two-decade hold on the governor’s office in Mississippi.

On Mr Bevin’s defeat, Mr Trump’s 2020 campaign manager suggested the president’s presence at a rally in the state boosted his vote-share.

“The president just about dragged Gov. Matt Bevin across the finish line, helping him run stronger than expected in what turned into a very close race at the end,” Brad Parscale said.