Votes were being counted across half the United States as the energy and outrage of the Democratic resistance faced off against the brute strength of President Donald Trump's GOP in a fight for control of Congress and statehouses across the nation.
Fundraising, polls and history were not on the president's side. But two years after an election that proved polls and prognosticators wrong, an air of uncertainty and stormy weather across parts of the country clouded the outcome of high-stakes elections from Florida to Alaska and everywhere in between.
Senators Bernie Sanders of Vermont and Elizabeth Warren of Massachusetts easily won re-election as they consider bids for the Democratic presidential nomination. Other 2020 prospects on the ballot included New York Senator Kirsten Gillibrand and New York Governor Andrew Cuomo.
Anxious Republicans privately expressed confidence in their narrow Senate majority but feared the House was slipping away. The GOP's grip on high-profile governorships in Florida, Georgia and Wisconsin were at risk as well.
"Everything we have achieved is at stake," Trump declared in his final day of campaigning.
Long lines and malfunctioning machines marred the first hours of voting in some precincts, including in Georgia, where some voters reported waiting up to three hours to vote in a hotly contested gubernatorial election. More than 40 million Americans had already voted, either by mail or in person, breaking early voting records across 37 states, according to an AP analysis.
Nearly 40 percent of voters cast their ballots to express opposition to the president, according to AP VoteCast, a national survey of the electorate, while one-in-four said they voted to express support for Trump.
The nationwide survey indicated that nearly two-thirds said Trump was a reason for their vote. Overall, six in 10 voters said the country was headed in the wrong direction, but roughly that same number described the national economy as excellent or good.
Trump encouraged voters to view the first nationwide election of his presidency as a referendum on his leadership, pointing proudly to the surging economy at recent rallies.
He bet big on a xenophobic closing message, warning of an immigrant "invasion" that promised to spread violent crime and drugs across the nation.
Several television networks, including the president's favourite Fox News Channel, yanked a Trump campaign advertisement off the air on the eve of the election, determining that its portrayal of a murderous immigrant went too far.
The president's current job approval, set at 40 percent by Gallup, was the lowest at this point of any first-term president in the modern era. Both Barack Obama's and Bill Clinton's numbers were 5 points higher, and both suffered major midterm losses of 63 and 54 House seats respectively.
Democrats needed to pick up two dozen seats to seize the House majority and two seats to control the Senate.
All 435 seats in the US House were up for re-election, although fewer than 90 were considered competitive. Some 35 Senate seats were in play, as were almost 40 governorships and the balance of power in virtually every state legislature.
Trump spent Tuesday at the White House, tweeting, making calls, monitoring the races and meeting with his political team.
He and the first lady were to host an evening watch party for family and friends. Among those expected: Vice President Mike Pence and former House Speaker Newt Gingrich, an informal adviser to the president.
Democrats, whose very relevance in the Trump era depended on winning at least one chamber of Congress, were laser-focused on health care as they predicted victories that would break up the GOP's monopoly in Washington and state governments.
Democrats could derail Trump's legislative agenda for the next two years should they win control of the House or the Senate. Perhaps more important, they would claim subpoena power to investigate Trump's personal and professional shortcomings.
Some Democrats have already vowed to force the release of his tax returns. Others have pledged to pursue impeachment, although removal from office is unlikely so long as the GOP controls the Senate or even maintains a healthy minority.
Tuesday's elections also tested the strength of a Trump-era political realignment defined by evolving divisions among voters by race, gender, and especially education.
Trump's Republican coalition is increasingly older, whiter, more male and less likely to have a college degree. Democrats are relying more upon women, people of colour, young people and college graduates.
Women voted considerably more in favour of their congressional Democratic candidate with fewer than four in 10 voting for the Republican, according to VoteCast, a nationwide survey of more than 113,000 voters and about 20,000 nonvoters conducted for The Associated Press by NORC at the University of Chicago.