Republicans moved toward expanding their control of the Senate as Democrats took power in the House, with incomplete election results pointing toward a reaffirmation of a deeply divided nation.

The Republicans flipped seats in three states — Indiana, Missouri and North Dakota — that President Trump had won by a large margin in 2016, and won an open seat in Tennessee. Senator Ted Cruz of Texas held off a surprisingly strong challenge from Beto O’Rourke.

Democrats won control of the House, a significant victory for a party locked out of power since the 2016 elections.

The Democratic win means a deadlocked Congress with Republicans in control of the Senate and Democrats in the lower chamber

This is a major setback for the Trump administration, which is likely to face an onslaught of congressional investigations. Even before the election, House Democrats had begun preparing a flurry of hearings, subpoenas and inquiries into nearly every aspect of the president and his White House.

While Democrats were favored to win back the House, their victory was far from assured.