President Donald Trump was the biggest name not on the ballot for elections Tuesday night, but he still lost — and won — in a number of significant ways.

Nowhere was that clearer in the split result that was on track to expand U.S. Senate control by Trump’s fellow Republicans, while flipping control of the House of Representatives to Democrats.

Both outcomes will likely have major effects, positive and negative, on Trump’s agenda — and possibly the fate of his presidency.

But the president also Wednesday could see political downside for him in the results from state-level elections. On the other hand, GOP victories in key presidential swing states could bolster Trump’s confidence of winning re-election in 2020.

Here’s how Tuesday’s mixed midterm results could affect Trump.

The House

No result is more damaging for Trump and his agenda than Democrats regaining control of the House.

The Democratic victory means the party has effective veto power over legislative initiatives sought by the Trump administration.

To get a bill passed into law, Trump, and Republicans in the Senate and the House, will have to negotiate with Democrats in ways they have not been accustomed to for some time.

In particular, Republicans will be unable, as they tried to do in 2017, to effectively repeal and replace much of the Affordable Care Act, as the Democrat-backed Obamacare law is formally known.

With their regained power, Democrats, who will take over committee chairships, also will be in position to investigate Trump and his administration in a variety of areas that Republicans showed scant interest in examining when they controlled the House.

That includes eyeing the president’s campaign contacts with Russians, foreign financial connections to the Trump Organization, Trump’s immigration enforcement actions and controversial spending by a number of Cabinet secretaries.

Rep. Jerrold Nadler, D-N.Y., who will become chairman of the Judiciary Committee, pointedly reminded Trump on Tuesday night that “he and his administration will be held accountable.”

Another big target for Democrats in the House will be Trump’s personal income tax returns, which the president, flying in the face of decades of common practice by his predecessors, has refused to make public.

MSNBC reported Tuesday night that Democrats in control of the House Ways and Means Committee plan on requesting Trump’s tax returns under a federal law that gives them such power. Sources who spoke with MSNBC said the committee will be willing to go to court to force Trump to comply with a subpoena for his returns if he refuses.

Asked at a news conference Wednesday what he would do if a subpoena is issued for his tax returns, Trump said, “Look, they’re under audit, they’re extremely complex, people wouldn’t understand them.”

“People don’t understand tax returns,” he said. Trump added that he would consider releasing his returns once an audit was completed by the IRS, but “nobody turns over returns when it’s under audit.”

Trump also warned that if House Democrats inundate his administration with subpoenas, “we’re going to do the same thing,” and predicted the government would then effectively shut down.

House Democrats now also will have the power to impeach Trump if they choose.

But Pelosi has dumped cold water on that idea, which has been pushed by some Democrats, telling PBS’ “News Hour” “that’s not what our caucus is about.”

The Senate

The fact that Republicans not only retained their majority in the Senate, but will add several seats, was Trump’s biggest victory Tuesday night.

That win means Trump will be able to continue nominating, and winning approval for those nominations, of conservatives to the federal judiciary.

While the Senate’s recent controversial approval of federal appellate Judge Brett Kavanaugh to the Supreme Court received widespread attention, Trump in his first two years had also won approval from the Senate for 83 other nominees to the federal bench.

Federal judges have their seats for life. As a result, Trump’s nominees will be around for decades, putting their imprint on thousands of cases, even when or if Democrats regain the White House.

Keeping the Senate in Republican control also gives Trump a firewall if Democratic leaders change their minds and decide to impeach the president.

The Senate would be the site for Trump’s trial if he is impeached, and it would take a two-thirds majority of the Senate to convict him — an extremely high bar, particularly when a president’s party is in control of that congressional chamber.

Individual states

Trump’s electoral fortunes in 2020 may be buoyoed by the performance of individual Republican candidates he supported, including Ron DeSantis, the apparent winner of the Florida governor’s race, and Mike DeWine, who won his race for Ohio governor.

“How about the governor of Ohio?” Trump said at his news conference. “A fantastic man who was down in the polls. I went up there and did a rally, and now they have a great governor.”

Both Florida and Ohio are key battlegrounds during a presidential election, with 29 and 18 votes, respectively, in the Electoral College. Trump won both states in 2016, and will be keen on doing so again in 2020.

Another notch in the president’s belt that could help boost his hope for re-election was the victory by Republican Mike Braun in Indiana over Sen. Joe Donnelly, a Democrat.

But other election results in a number of other states suggest that Trump’s odds of winning a second term could have gotten longer.

Democratic candidates flipped control of the governors’ office of seven states: Maine, Michigan, Wisconsin, Illinois, Kansas, New Mexico and Nevada. In Kansas, close Trump ally Kris Kobach was soundly beaten.

Trump had won three of those states in his 2016 race: Michigan, Wisconsin and Kansas.

If Trump were to lose Michigan and Wisconsin in 2020 — and their combined 26 electoral votes — he would not win a second term if he also lost 11 more electoral votes elsewhere from the states he won in 2016.

In another setback for Trump, Democratic Sen. Jon Tester of Montana was the apparent winner of his race, according to results Wednesday. The president had singled out Tester for criticism in recent weeks, blaming him for the failed nomination of the president’s personal physician, Ronny Jackson, as secretary of Veterans Affairs.

Tester’s resilience in a state in which Trump had won 50 out of 56 counties also underscores the limits of the president’s powers of political persuasion, even in so-called red states.

Statehouses

Much less attention has been paid nationally this election cycle to the thousands of candidates running for seats in state legislative bodies, and ballot measures in individuals states.

But the news Wednesday from those races for Trump was, on balance, bad.

Democrats gained full control of six statehouses — meaning the governor’s seat and majorities in both legislative bodies — while Republicans lost full control of four statehouses.

Democrats picked up full control of state governments in Colorado, Illinois, Maine, New Mexico, New York and Nevada.

Republicans lost full control in Kansas, Michigan, New Hampshire and Wisconsin.

And in Florida, voters approved a referendum that will restore voting rights to felons who have finished serving their criminal sentences.

That outcome will allow around 1.5 million felons to vote from now on in Florida, which is notorious on election nights for its extremely close results. Given recent outcomes in Florida, if only a fraction of those felons vote in 2020, it could provide the margin of victory for a presidential candidate in the state, and by extension possibly tip the balance in the Electoral College.