Democrats take control of the House of Representatives, while Republicans retain Senate control.

After rallying voters against President Donald Trump, the Democratic Party has flipped the United States House of Representatives, gaining a majority in midterm elections that followed two years of Republican control of both Congressional chambers.

On Tuesday, the Republicans lost their majority in the House, Congress’ lower chamber, after a Democratic surge during a dramatic midterm campaign season marred by violence and hostile political rhetoric.

With a House majority, Democrats will have the power to investigate Trump’s tax returns and possible conflicts of interest, and challenge his overtures to Saudi Arabia, Russia and North Korea.

They also could force Trump to scale back his legislative ambitions, possibly dooming his promises to fund a border wall with Mexico, pass a second major tax-cut package or carry out his hardline policies on trade.

Going into Election Day, Democrats needed to gain 23 seats in order to take back the House, which would allow them to throw a wrench in Trump’s agenda on contentious issues, among them immigration.

Tuesday’s vote was the first nationwide election since the 2016 presidential elections, during which Trump beat Democratic candidate Hillary Clinton and Republicans gained majorities in both the House and Senate.

{articleGUID}

But after nearly two years of increasingly heated and polarised politics in the US, Democrats sought to turn anger into votes.

Despite capturing the House, Democrats were unable to take over the Senate, where Republicans maintained a firm majority.

Trump a factor

In the lead-up to the race, most analysts and polls expected Republicans to keep the Senate and lose the House.

Early exit polls showed Trump was a major factor for nearly two-thirds of voters who cast their ballots, while a CBS News poll found that 55 percent said they disapproved of the president’s performance.

Tuesday’s result was a bitter outcome for Trump, a 72-year-old former reality TV star who campaigned for fellow Republicans on increasingly hostile anti-immigrant rhetoric and was accused of inciting violence in recent weeks.

{articleGUID}

Just weeks before the vote, a Trump supporter allegedly shipped pipe bombs to some of the president’s most prominent critics, among them former President Barack Obama, Hillary Clinton and Hungarian-American billionaire George Soros.

The packages were intercepted by authorities and no one was injured.

A day after the suspect was arrested, a gunman carried out one of the deadliest anti-Semitic massacres in US history, storming a synagogue in Pittsburgh, Pennsylvania, and killing 11 worshippers.

Critics, including the Democrats, accused Trump of employing racist and xenophobic rhetoric that incited violence, a charge he and many of his fellow Republicans rejected.