Donald Trump has hailed the Republicans' performance in the US midterm elections as a "tremendous success" - despite losing overall control of Congress.
The Democrats are projected to take back control of the House of Representatives, meaning the president now faces a much tougher time putting his agenda into action.
But Mr Trump - who declared on the eve of polling day that "everything we have achieved is at stake" - will delight in the fact the Republicans managed to keep control of the Senate.
And it was likely this fact that he was referencing when he tweeted: "Tremendous success tonight. Thank you to all!"
Mr Trump also quoted tweets from television pundits praising him, including one who referred to the president as the "magic man".
House Democratic leader Nancy Pelosi said Americans have "had enough of division", declaring: "Tomorrow will be a new day in America."
A blue takeover of Congress would have been a disaster for the president - and increased the chances of his opponents launching efforts to remove him from office through impeachment.
But as the dust settles on the elections, which are viewed as a referendum on the sitting president, Mr Trump will likely be breathing a sigh of relief.
Despite waves of losses in the House there were bright spots to celebrate for the Republicans in the Senate.
Ted Cruz held off the challenge of Beto O'Rourke in Texas, while the party unseated the Democratic incumbents in Florida, Indiana, North Dakota and Missouri.
However, Democrats will view House victories in states like Florida, Virginia, Pennsylvania and Minnesota as cause for optimism as they prepare to hold the president to account in the run-up to the 2020 presidential election.
The party will also welcome a number of victories in the races for state governor - with wins over the Republicans in Illinois, Kansas, Michigan, Maine and New Mexico.
This election cycle - which had a record number of women elected to the House and an unprecedented number of candidates of colour standing - also saw a number of firsts.
Ilhan Omar of Minnesota and Rashida Tlaib of Michigan, who are both Democrats, will be the first Muslim women to serve in Congress.
Deb Haaland (New Mexico) and Sharice Davids (Kansas) will serve as the first two Native American women in Congress.
In Colorado, Jared Polis will be the country's first openly gay governor.
More from Donald Trump