Staring down the potential loss of one-party control in Washington, President Donald Trump declared Tuesday’s election results a “tremendous success” for Republicans as his party maintained its hold on the Senate while Democrats picked up GOP-held seats in the House.

Trump waited until late in the night to weigh in on the midterm vote, tweeting a succinct message that overlooked expected Democratic gains in the House, writing: “Tremendous success tonight. Thank you to all!”

With results still coming in, Republicans had a chance to increase their majority in the Senate. Democrats were gaining speed in their quest for the House, which would give them the ability to launch investigations into the president and stymie his agenda.

“Maybe you get a ripple, but I certainly don’t think that there’s a blue wave,” she told reporters, pointing to several early Republican wins.

As for Republicans retaining control of the Senate, she called it “a huge moment and victory for the president.”

The White House has been stressing the historical headwinds it faced: In the last three decades, 2002 was the only midterm election when the party holding the White House gained Senate seats. And only twice in the past eight decades has the president’s party picked up House seats in the midterms.

Trump spent election night watching returns with family and friends at the White House, his shadow looming large over the results.

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 about 25 percent said they voted to express support for Trump.

Opposition to Trump proved to be more a motivating factor for Democrats than support for the president a factor for Republicans. Still, Republican voters tended to be overwhelmingly supportive of the president.

Faced with the possibility of keeping the Senate but losing the House, aides in recent days had laid out the political reality to Trump, who could face an onslaught of Democratic-run investigations. In turn, Trump began trying out defensive arguments ahead of Election Day, noting that midterm losses are typical for the party in the White House, pointing out a high number of GOP retirements and stressing that he had kept his focus on the Senate.

Aides set up televisions in the White House residence for Trump, first lady Melania Trump and their guests to watch election results come in, with the sets tuned to different cable news channels. Among those expected were Trump’s adult children, White House aides, Republican officials and presidential friends.

The election served as a referendum of sorts on Trump’s racially charged appeals and the strength of the coalition that powered him to the White House — a group he will need again in just two years.

Sanders said candidates who welcomed Trump did better at the polls.

“Most of the candidates that the president actually went in and campaigned for and who embrace the president are doing well tonight,” she said.

Overall, more voters disapproved of Trump’s job performance than approved — a finding that is largely consistent with recent polling. Voters scored Trump positively on the economy and for standing up “for what he believes in.” But the president received negative marks from voters on temperament and trustworthiness.

Still, about one-third of voters said Trump was not a factor in their votes.

Trump’s scorched-earth campaigning came to define the 2018 campaign. In the final days, he sought to motivate supporters with the battle over the confirmation of Supreme Court Justice Brett Kavanaugh — at one point mocking a woman who claimed the judge had sexually assaulted her when they were in high school.

Ahead of the election, both parties claimed that the emotionally charged debate over Kavanaugh’s confirmation would motivate their supporters to turn out. According to VoteCast, half of voters said the tumultuous process was very important to their vote and they broke for the Democratic House candidate.

Returning to his immigration-heavy 2016 playbook, Trump went on to unleash his full fury on a caravan of migrants slowly making their way to the southern border. His take-no-prisoners approach troubled many Republicans seeking to appeal to moderate voters in suburban House districts, but Trump prioritized base voters in the deep-red states that could determine the fate of the Senate. At times he even appeared at odds with his own campaign, which in the election’s final days released a gauzy ad aimed at suburban women.

Trump did not care for the soft-focus ad, which notably did not mention him, according to a person familiar with the president’s thinking who was not authorized to speak publicly. Instead he promoted a shocking, expletive-loaded video featuring a Latino man convicted of murdering two police officers, which was widely decried as being racist.

But while Trump’s plays to his most loyal supporters helped rev up the crowds in small towns and rural areas in red states, they were viewed as a turnoff to moderates, independents and women in the suburban districts needed to keep the House in GOP hands. Still, Trump brushed off criticism that he was alienating moderate voters as he continued his massive rallies and overheated rhetoric.

___

Follow Lucey on Twitter at http://twitter.com/@catherine_lucey and Lemire at http://twitter.com/@JonLemire

___

For AP’s complete coverage of the U.S. midterm elections: http://apne.ws/APPolitics