Donald Trump faced greater restraints on his presidency after Democrats won control of the House of Representatives and pledged to hold the Republicans accountable after a tumultuous two years in the White House.
Trump and his fellow Republicans expanded their control of the Senate in Tuesday's midterm elections, following a divisive campaign marked by fierce clashes over race and immigration.
But they lost their majority in the House, a setback for Trump after a campaign that became a referendum on his leadership.
With some races still undecided, Democrats were headed for a gain of more than 30 seats, beyond the 23 they needed to claim their first majority in the 435-member House in eight years.
Seizing the Senate had never looked a likely prospect for the Democrats, and in the event they fell short of a tidal wave of voter support that would have given them control of both chambers of Congress.
Winning a Senate majority would have allowed Democrats to apply the brakes even more firmly on Trump's policy agenda and given them the ability to block any future Supreme Court nominees.
However, the Democrats will now head House committees that can investigate the president's tax returns, possible business conflicts of interest, and possible links between his 2016 election campaign and Russia.
The Democrats could also force Trump to scale back his legislative ambitions, possibly dooming his promises to fund a border wall with Mexico, pass a second major tax-cut package, or carry out his hardline policies on trade.
“Today is more than about Democrats and Republicans, it's about restoring the Constitution's checks and balances to the Trump administration," Nancy Pelosi, leader of the House Democrats, told supporters at victory party.
Despite the Republican loss of the House, Trump wrote on Twitter, "Tremendous success tonight."
Early on Wednesday, he added: "Received so many Congratulations from so many on our Big Victory last night, including from foreign nations (friends) that were waiting me out, and hoping, on Trade Deals. Now we can all get back to work and get things done!"
It was not clear what Trump meant by his reference to trade deals. In pressing for what he views as better trade terms for America, he has imposed import tariffs and pushed Canada and Mexico into agreeing an overhaul of the NAFTA trade accord.
Trump, 72, had hardened his rhetoric in recent weeks on issues that appealed to his conservative core supporters. He threw himself into the campaign, issuing warnings about a caravan of Latin American migrants headed to the border with Mexico and condemnations of liberal American "mobs" he says oppose him.
The party with the presidency often loses House seats in midterm elections. Former President Barack Obama's Democrats suffered what he called a "shellacking" in congressional elections in 2010.
With divided leadership in Congress and a president who has taken an expansive view of executive power, Washington could be in store for even deeper political polarization and legislative gridlock.
Financial markets often favor Washington gridlock because it preserves the status quo and reduces uncertainty, even though many in the market this time around had been hoping for a continuation of the Republican agenda.
Wall Street was set for a modestly firmer open on Wednesday and global stocks rose after the election results. The fact that House gains for Democrats may rule out further tax cuts sent the dollar and Treasury yields sharply lower.
"With the Democrats taking over the House we will now have to see what gridlock in Congress means for policy. As for the market impact, a split Congress has historically been bullish for equities and we expect to see the same pattern again," said Torsten Slok, Chief International Economist of Deutsche Bank.
Losing the House will test Trump's ability to compromise, something he has shown little interest in over the last two years with Republicans controlling both chambers of Congress.
There may be some room to work with Democrats on issues with bipartisan support such as an infrastructure improvement package or protections against prescription drug price increases.
"We will have a responsibility to find our common ground where we can, stand our ground where we can't," said Pelosi, who has been one of the most frequent targets for Trump's scathing attacks on his critics and political opponents.
Foreign policy has been an area that Trump has approached in a very personal way, sometimes antagonizing allies such as Canada while making what critics see as unduly warm overtures to traditional rivals or foes.
But House Democrats are expected to try to harden U.S. policy toward Saudi Arabia, Russia and North Korea, and maintain the status quo on areas like China and Iran.
The Kremlin said on Wednesday it saw no prospects for an improvement in relations following the elections.
"We can say with a large amount of confidence that of course no bright prospects for normalizing Russian-American relations can be seen on the horizon," Kremlin spokesman Dmitry Peskov said.
Trump has sought better ties with Russia but the two countries are at odds over the civil war in Syria, a nuclear arms treaty and the U.S. allegations of election meddling.
In Germany, Foreign Minister Heiko Maas said on Wednesday it would be wrong to expect policy change from Trump.
Every seat in the House was up for grabs on Tuesday. The Republicans had an advantage in Senate races because elections were held for only 35 seats in the 100-member chamber and many of them were in states that often lean Republican.
Republicans built on their slim Senate majority by several seats and ousted four incumbent Democrats: Bill Nelson in Florida, Joe Donnelly in Indiana, Heidi Heitkamp in North Dakota and Claire McCaskill in Missouri.
Those gains are sure to bolster Republicans' efforts to get conservative federal judges through confirmation proceedings during a "lame duck" session that starts next week, as well as from January when the new Congress convenes.
In the 36 gubernatorial contests, Democrats won governorships in states that supported Trump in 2016 but lost high-profile races in Florida and Ohio.
Democrats could make life difficult for Trump by launching another congressional investigation into allegations of Russian interference on his behalf in the 2016 election. A federal probe by U.S. Special Counsel Robert Mueller into Russia's role in that election is ongoing.
Moscow denies meddling and Trump denies any collusion.
A House majority would be enough to impeach Trump if evidence surfaced of collusion by his campaign, or of obstruction by the president of the federal investigation. But Congress could not remove him from office without a conviction by a two-thirds majority in the Republican-controlled Senate, an unlikely scenario.
Most Democratic candidates in tight races stayed away from harsh criticism of Trump during the midterm campaign's final stretch, focusing instead on bread-and-butter issues like maintaining insurance protections for people with pre-existing medical conditions, and safeguarding the Social Security retirement and Medicare healthcare programs for senior citizens.
The Democratic gains were fueled by women, young and Hispanic voters, a Reuters/Ipsos Election Day poll found. Fifty-five percent of women said they backed a Democrat for the House this year, compared to 49 percent in the 2014 midterm congressional election.
A record number of women ran for office this election, many of them Democrats. The party picked up seats across the map but some of the campaign's biggest Democratic stars lost.
Liberal Beto O'Rourke's underdog Senate campaign fell short in conservative Texas against Republican Ted Cruz. Andrew Gillum lost to Republican Ron DeSantis in his quest to become Florida's first black governor.
The gubernatorial race in Georgia, where Democrat Stacey Abrams was seeking to become the first black woman to be elected governor of a U.S. state, remained too close to call early on Wednesday.