(CNN) Democrats were celebrating Tuesday night, while President Donald Trump and Republicans were left to explain why they were behind in one of the reddest states in the nation.

In Kentucky , Democratic Attorney General Andy Beshear was poised to defeat Republican Gov. Matt Bevin, holding onto a 0.4-percentage-point lead with all precincts reporting even as Bevin said he would not concede. Trump had tried to bolster Bevin, holding a rally with him Monday night in Kentucky and telling the state's GOP voters that the race's outcome would be seen as a reflection on him.

If Beshear hangs on, he has said he would ease Medicaid access, overhaul the state's education leadership and restore the voting rights of former felons who have done their time.

In Virginia , Democrats won majorities in both the House and Senate, giving the party full control of the state's government and solidifying what had once been a swing state as a stronghold for the party. Their wins open the door for new gun control laws, an increased minimum wage and other progressive measures that Republicans had previously blocked.

And in Mississippi , Republicans had held onto the governor's office, beating back a veteran Democrat's bid for another potential election-night stunner. The GOP's win there means the state is likely to continue pursuing tax cuts and opposing an expansion of Medicaid.

Here are three takeaways from Tuesday's elections:

Kentucky governor's race spells trouble for Republicans

It's true that Bevin was a troubled candidate. He worked to roll back Kentucky's Medicaid expansion. His brash style was on display when he accused protesting teachers of being "selfish" and having a "thug mentality" when they objected to his efforts to slash their pensions. Polls showed he was among the nation's least popular governors.

But make no mistake: National Republicans were all-in on Bevin.

Trump spent Monday night rallying with Bevin in Kentucky. Vice President Mike Pence last week went on a bus tour with the first-term governor. And the Republican Governors Association spent millions of dollars attempting to bolster him on the airwaves.

Republicans sought to explain away Tuesday's result -- trailing in the governor's race in a state Trump won by 30 percentage points -- by pointing to their victories in five down-ballot statewide races and throwing Bevin under the bus.

"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," Trump 2020 campaign manager Brad Parscale said in a statement.

But the causes for criticism of Bevin -- his combative personality, penchant for controversy and pursuit of controversial policies -- could also apply to Trump.

And Trump himself, just a night earlier, had said the outcome of Bevin's reelection bid would be a reflection on him.

"If you lose, they're going to say Trump suffered the greatest defeat in the history of the world. This was the greatest. You can't let that happen to me," he told Bevin at their rally.

That the GOP trails in the governor's race in a state Trump won by 30 percentage points is a bad sign for the party across the board. Senate Majority Leader Mitch McConnell, the most powerful Kentuckian in politics and a veteran of tough elections, is on the ballot next year. And while Tuesday's results don't necessarily forecast trouble for McConnell, they do likely mean Amy McGrath, a leading Democratic challenger, will likely see a fundraising boon.

If Beshear is ultimately certified the winner, he has said he would pursue an agenda of making Medicaid more accessible -- restoring the policies of his father, popular former Gov. Steve Beshear, who expanded the program before leaving office four years ago. He has also said he would replace Bevin's state board of education and allowing 140,000 former felons who have served their time to vote.

A Democratic trifecta in Virginia

Democrats cemented a new reality in Virginia on Tuesday: For decades a Republican stronghold, and then a swing state, the commonwealth is now controlled by Democrats.

The party won majorities in Virginia's House and Senate, gaining full control of the state government for the first time in two decades.

The victories put Gov. Ralph Northam and Democrats in the legislature in position to pursue a progressive agenda -- including gun control measures, which a majority of Republicans had blocked, and a higher minimum wage.

With the "trifecta" of the House, Senate and governor's office, Democrats will also control the redistricting process after the 2020 Census, drawing the new maps for congressional and state legislative districts.

That was a key focus for the party in the wake of state-level losses during former President Barack Obama's administration. Each trifecta represents a foothold that can be used to bolster the party's ranks in Congress and to cement their status as the majority party in statehouses for another decade.

Tuesday's results were a continuation of the years-long collapse of the GOP in what until recently had been a swing state. Virginia voted for George W. Bush in the 2004 presidential election and elected Republican Bob McDonnell governor in 2009, but has backed Democratic presidential and gubernatorial candidates since those elections.

The victories completed a Democratic comeback in the state legislature that began in 2017, when Democrats made major gains in the legislature, largely through suburban districts, and Northam won handily in an early sign of backlash over Trump's presidency.

That election left the GOP with a 51-49 House majority and a 21-19 advantage in the Senate, and Democrats immediately began targeting legislative seats in hopes of winning control this year.

But that comeback was threatened this year when Northam was accused of appearing in a yearbook photo dressed in blackface, and Lt. Gov. Justin Fairfax was accused of sexually assaulting two women.

GOP wins in Mississippi

The best news of the night for Republicans came in Mississippi, where they won the race to replace outgoing Gov. Phil Bryant.

The governor's race in such a solidly red state would ordinarily be no cause for suspense.

But Lt. Gov. Tate Reeves faced a serious challenge from Democratic Attorney General Jim Hood, a moderate candidate who had already won statewide four times.

The race was in part a referendum on expanding Medicaid: Reeves, an anti-spending conservative, said he would continue the state's rejection of an expansion under Obamacare, while Hood said he would expand Medicaid to cover an additional 100,000 people.

Reeves was also bolstered by campaign appearance from Trump, his son Donald Trump Jr. and Pence.

Trump congratulated Reeves Tuesday night.

"Our big Rally on Friday night moved the numbers from a tie to a big WIN. Great reaction under pressure Tate," Trump tweeted.