Control of Congress will be divided next year, as Democrats won back the House of Representatives but President Donald Trump’s Republicans maintained their Senate majority in crucial midterms, networks projected Tuesday.

Democrats will pick up the 23 seats necessary to win a House majority, Fox and NBC reported, as they knocked off Republicans in swing states like Virginia, Florida, Pennsylvania and Colorado in elections seen as the first nationwide referendum on Trump’s performance.

But Republicans struck back in the 100-member Senate, where they ousted at least two Democrats, in Indiana and North Dakota, and held on to at-risk seats in Tennessee and Texas.

US President Donald Trump thanked the voters after the declaration of the results.

American voters poured out across their bitterly divided country Tuesday to deliver judgment on Donald Trump in midterm polls where opposition Democrats hope to seize at least partial control of Congress.

From New York to California and from Missouri to Georgia there were long lines from early morning at polling stations as voters finally got their say, following a heated, often tense campaign.

All 435 seats in the House of Representatives, 35 seats in the 100-member Senate and 36 governorships were up for grabs.

Trump himself noted the energy as he wrapped up a punishing schedule of rallies around the country that were intended to boost Republican candidates — and his own brand heading towards reelection in 2020.

“The midterm elections used to be, like, boring,” Trump told a crowd in Cleveland, Ohio, on Monday. “Now it’s like the hottest thing.”

Trump has spent months ahead of the midterms deriding the Democrats as bent on destroying the US economy and allowing criminals to run riot.

According to Michael McDonald of the US Elections Project, 38.4 million Americans cast their ballots early ahead of this election, compared with 27.4 million in the 2014 midterm.

(With agency inputs)