The precise size of the GOP Senate majority will likely have limited impact on legislation. Because Democrats appear to have won back the House, any further effort to repeal the Affordable Care Act, for example, is doomed. But Republican control of the Senate, however narrow, will allow Trump to make an even deeper conservative imprint on the federal judiciary, and potentially on the Supreme Court. Republicans have confirmed dozens of appellate and district-court judges in the past two years, and they have cemented a conservative Supreme Court majority with the elevation of Justices Neil Gorsuch and Brett Kavanaugh.

Republicans captured their first major Senate battleground shortly before 9 p.m. eastern time, when the networks called the Indiana race for Mike Braun, a businessman who ran as a conservative outsider against Donnelly, a centrist Democrat. Later in the evening, GOP Representative Kevin Cramer defeated Heitkamp in North Dakota, and McCaskill lost to state Attorney General Josh Hawley in Missouri.

Democrats scored their own victories in West Virginia, where Senator Joe Manchin defeated the state’s attorney general, Patrick Morrisey; and in New Jersey, where the scandal-tarred Senator Bob Menendez held on despite an aggressive and well-funded challenge from the businessman Bob Hugin. The Menendez race became competitive after the longtime Democratic senator was tried on corruption charges and admonished by the Senate Ethics Committee. A federal trial ended in a hung jury.

Read: An existential moment for Democrats

Republicans retained a critical seat in Tennessee, where Blackburn defeated Bredesen, the state’s former governor, in a race that Democrats had higher hopes for earlier in the campaign.

In the closing weeks, the races for control of the House and the Senate seemed to cleave in separate directions. The Senate campaign was fought largely on Republican turf, unlike many of the critical House races playing out in GOP-held districts that swung toward Democrats in 2016. Led by Trump, the GOP tried to press its advantage by hammering Democrats over their treatment of the Supreme Court nominee—and now justice—Kavanaugh, and by summoning fears of a migrant caravan of refugees moving north through Central America toward Mexico and the southern border.

Trump, too, played sharply different roles in the most competitive House and Senate contests. Many House contenders in suburban districts that have turned against Trump wanted nothing to do with the president and touted their willingness to oppose him. But GOP Senate candidates like Hawley in Missouri, Cramer in North Dakota, Braun in Indiana, and Morrisey in West Virginia welcomed him to enormous rallies in the hope that he could drive his loyal supporters to the polls.

And as his party’s fortunes sagged in one chamber and improved in the other, Trump tried to take credit for the GOP’s Senate campaigns while dismissing potential losses in the House as par for the course for a first-term president. “I think we’re going to do well in the House,” he told reporters on Sunday. “But as you know, my primary focus has been on the Senate, and I think we’re doing really well in the Senate.”