Democratic supporters cheer at their party in Richmond, Va., Tuesday, Nov. 5, 2019. All seats in the Virginia House of Delegates and State Senate are up for election. (AP Photo/Steve Helber)

Democrats took full control of the Virginia legislature for the first time in more than two decades while the race for governor in deeply Republican Kentucky was too close to call despite a last-minute boost from President Donald Trump.

In Kentucky, Democratic challenger Andy Beshear held a narrow lead and declared victory in the governor's race over Republican incumbent Matt Bevin on Tuesday, though Bevin had not conceded. And in Virginia, Democrats flipped control of the state Senate and House, gaining outright control of state government in a state that is often a battleground for the White House.

"I'm here to officially declare today, Nov. 5, 2019, that Virginia is officially blue," Democratic Gov. Ralph Northam told a crowd of supporters in Richmond.

A year before the presidential election, the results offered warning signs for both parties. Voters in suburban swaths of Kentucky and Virginia sided with Democrats, a trend that would complicate Trump's path to reelection if it holds. And the Democrats who made gains on Tuesday did so by largely avoiding positions such as "Medicare for All" that have animated the party's left flank in the Democratic presidential primary.

Democratic pickups in Virginia occurred in Washington, D.C., and Richmond suburbs that already had trended in the party's direction in recent years. In Kentucky, Beshear gained considerable ground on Bevin in Kentucky's suburban Cincinnati, Ohio, counties that had helped propel the Republican to office four years ago. Other statewide GOP candidates in Kentucky won by comfortable margins. But the dip at the top of the ticket still offered another example in the Trump era of suburban voters' willingness to abandon established Republican loyalties — even with the president making a personal appeal on behalf of a GOP standard-bearer.

Trump's 2020 campaign manager tried to find a positive frame for the results in a state Trump won by 30 percentage points in 2016.

"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.

Trump may depend on Mississippi, where he also campaigned in the final stretch before Election Day, for something to crow about. With Republican Gov. Phil Bryant term-limited, GOP nominee Tate Reeves defeated Democrat Jim Hood to extend the GOP's 20-year hold on the state's top office. But even that contest could finish with a single-digit margin in a state Trump won by 28 percentage points three years ago.

The tighter result for Reeves reflected the same suburban trends seen in other states. Heavily Republican counties outside Jackson, Mississippi, and Memphis, Tennessee, still tilted to the GOP nominee but by noticeably narrower margins than what Bryant had four years ago to win a second term.

Legislative seats also were on the ballot in New Jersey, with Democrats positioned to maintain their overwhelming majorities and quell any opportunity for Trump to suggest that the Republicans were encroaching on Democratic territory ahead of 2020.

While Tuesday's results aren't necessarily predictive of what will happen next November, voters in multiple states tied their decisions to the national atmosphere, particularly the president.

In Kentucky, 73-year-old Michael Jennings voted straight Democratic. A Vietnam veteran, retired state worker and former journalist, Jennings described the president as unfit for office and a threat to American democracy.

"If Kentucky can send a small flare up that we're making the necessary turn, that's a hopeful sign that would have reverberations far beyond our state," he said.

Yet Richard Simmons, 63, a butcher from Glen Allen, Virginia, was just as staunchly in the GOP camp, saying he voted for GayDonna Vandergriff in a state House race. Her Republican affiliation, Simmons said, "means everything to me, especially now."

A staunch Trump support, Simmons called the impeachment investigation unfounded. "It's one diversion after another to keep Trump from doing anything," he said. "He's helped the economy, like, big-time. And I trust the guy."

To explain Kentucky, Republicans undoubtedly will echo the Trump campaign and focus on Bevin's weaknesses. He spent his term battling with state lawmakers — including Republicans — and teachers. Beshear, meanwhile, is well known as state attorney general and the son of Steve Beshear, who won two terms as governor from 2007 to 2016 even as the state trended more solidly Republican in federal elections. Still, a Bevin upset would leave Trump explaining why his signature tactic of late campaign rallies wasn't enough in a state he won easily in 2016.

Senate Majority Leader Mitch McConnell, who easily defeated Bevin in a 2014 Senate primary, also has a vested interest in the outcome. McConnell is favored to win reelection next year in Kentucky, even as national Democrats harbor hopes of defeating him. The powerful senator likely will see a fundraising bonanza for a potential challenger if Beshear prevails.

In Mississippi, Republicans have dominated state politics for two decades. Reeves, the current lieutenant governor, sought to capitalize on those GOP leanings after Hood, the attorney general, acknowledged that he voted for Hillary Clinton over Trump in 2016. Hood needed a high turnout of the state's African American voters and a better-than-usual share of the white vote to pull off the upset.

Reeves, Parscale said, will be "a tremendous conservative leader for Mississippians in fighting for freedom and keeping taxes low" and "a key ally" as 2020 approaches and Trump ramps up his push for reelection.

Elsewhere, voters in the West were deciding several ballot measures, with residents of Tucson, Arizona, appearing to overwhelmingly reject a proposal to designate it as Arizona's only sanctuary city.

The proposal called for new restrictions on when and where people could be asked about their immigration status and required officers to first tell people that they have a right not to answer questions about whether they're in the country legally. Tucson's all-Democratic City Council opposed the measure, citing concerns about the potential for losing millions of dollars in state and federal funding.

___

Follow Bill Barrow on Twitter at https://twitter.com/BillBarrowAP

Democratic supporters cheer their candidates at a Democratic Party event in Richmond, Va., Tuesday, Nov. 5, 2019. All seats in the Virginia House of Delegates and state Senate are up for election. (AP Photo/Steve Helber)
Democratic gubernatorial candidate and Kentucky Attorney General Andy Beshear, along with lieutenant governor candidate Jacqueline Coleman, acknowledge supporters at the Kentucky Democratic Party election night watch event, Tuesday, Nov. 5, 2019, in Louisville, Ky. (AP Photo/Bryan Woolston)
Candidate for the 94th District, Shelly Simonds, celebrates with supporters as election results begin to come in Tuesday, Nov. 5, 2019, at the Marriott in Newport News, Va. (Rob Ostermaier/The Virginian-Pilot via AP)
Kentucky Attorney General and Democratic gubernatorial candidate Andy Beshear speaks with Maddie Jones, of West Louisville, during a campaign stop at Southern Hospitality, Tuesday, Nov. 5, 2019, in Louisville, Ky. (AP Photo/Bryan Woolston)
President Donald Trump speaks during a campaign rally in Lexington, Ky., Monday, Nov. 4, 2019. (AP Photo/Susan Walsh)
Chief Election Official Sandy Pace wears her patriotic-themed boots while staffing the polling station at Drew Middle School on Election Day in Stafford, Va., Tuesday, Nov. 5, 2019. (Mike Morones/The Free Lance-Star via AP)
Lt. Gov. Tate Reeves, left, speaks with reporters while his wife Elee Reeves, laughs at his response outside their Flowood, Miss., voting precinct, Tuesday, Nov. 5, 2019. Reeves, the Republican nominee for governor is in one of the state's most hotly contested governor's race since 2003. Voters will also select six other statewide officials and decide on a host of legislative and local offices. (AP Photo/Rogelio V. Solis)
Voters make their way into the polling location at Abingdon High School Tuesday, Nov. 5, 2019 in Abingdon, Va. Along with the statewide races, voters in Washington County are voting on a new sheriff and a resolution concerning the future of their historic courthouse. (David Crigger/Bristol Herald Courier via AP)
A sign urging people to vote on municipal question #1 is displayed in Jersey City, N.J., Tuesday, Nov. 5, 2019. Residents of New Jersey's second-largest city will decide Tuesday whether its increasing popularity as an affordable short-term rental option across the river from New York City has reached the point where restrictions are needed to rein in some of the unwanted byproducts.(AP Photo/Seth Wenig)
Kentucky Attorney General and Democratic gubernatorial candidate Andy Beshear speaks with voters during a campaign stop at Wagner's Pharmacy, on Election Day, Tuesday, Nov. 5, 2019, in Louisville, Ky. (AP Photo/Bryan Woolston)
Declan Brady peeks under the voting booth while his grandmother Darlene Walker votes at Drew Middle School on Election Day in Stafford, Va., Tuesday, Nov. 5, 2019. (Mike Morones/The Free Lance-Star via AP)
Audrey Garnett, center, is greeted by candidates and campaign volunteers outside Smith Station Elementary School on Election Day in Spotsylvania, Va., Tuesday, Nov. 5, 2019. (Mike Morones/The Free Lance-Star via AP)
Kentucky Governor and Republican gubernatorial candidate Matt Bevin, right, shakes hands with a poll worker after casting his ballot in the state's general election in Louisville, Ky., Tuesday, Nov. 5, 2019. (AP Photo/Timothy D. Easley)
Voters line up to cast the ballots soon after the polls opened at the Oxford Conference Center in Oxford, Miss., Tuesday, Nov. 5, 2019. (Bruce Newman/The Oxford Eagle via AP)
Voters walk through a sea of campaign signs at a polling station in Richmond, Va., Tuesday, Nov. 5, 2019. All seats in the Virginia House of Delegates and State senate are up for election. (AP Photo/Steve Helber)
Voters line up to get ballots at a polling station in Richmond, Va., Tuesday, Nov. 5, 2019. All seats in the Virginia House of Delegates and State senate are up for election. (AP Photo/Steve Helber)