US Representatives address a press conference on remarks made by US President Donald Trump.

The US House of Representatives formally condemned Donald Trump on Tuesday for xenophobic attacks on four minority Democratic lawmakers and hostile language targeting immigrants, as the president pushed back at accusations of racism.

Top Republican leaders rallied around Trump, but four members of the president's party voted with the 235 Democrats to condemn him for "racist comments that have legitimized and increased fear and hatred of new Americans and people of color."

One independent lawmaker also supported the measure, which takes aim at Trump's weekend tweets telling a group of progressive Democratic congresswomen of color to "go back" to other countries.

The resolution also takes the president to task for "referring to immigrants and asylum seekers as 'invaders.'"

Trump has a long history of political pandering to white suspicions about other ethnic groups, and the resolution criticizes him for "saying that Members of Congress who are immigrants (or those of our colleagues who are wrongly assumed to be immigrants) do not belong in Congress or in the United States of America."

Democrats hold a majority in the 435-member House but are outnumbered by Republicans in the Senate, where the resolution is unlikely to be considered.

The four congresswomen -- all but one of whom were born in the US -- are of Hispanic, Arab, Somali and African-American descent.

Trump stuck by the provocative comments Monday and again Tuesday.

"Our Country is Free, Beautiful and Very Successful. If you hate our Country, or if you are not happy here, you can leave!" the president tweeted.

Democratic leaders denounced Trump's remarks, and rallied round the lawmakers -- Alexandria Ocasio-Cortez, Rashida Tlaib, Ilhan Omar and Ayanna Pressley.

Omar is the only one born outside the United States.

Slamming the "so-called vote" as a "Democrat con game," Trump urged his fellow Republicans not to "show 'weakness' and fall into their trap."

"Those Tweets were NOT Racist. I don't have a Racist bone in my body!" Trump said.

"This should be a vote on the filthy language, statements and lies told by the Democrat Congresswomen, who I truly believe, based on their actions, hate our Country," the president wrote.

"Nancy Pelosi tried to push them away, but now they are forever wedded to the Democrat Party," Trump added, in a jab at the House speaker who has had a tenuous relationship with the four left-leaning first-term congresswomen.

Speaking on the House floor prior to the vote, Pelosi said: "Every single member of this institution, Democratic and Republican, should join us in condemning the president's racist tweets.

"To do anything less would be a shocking rejection of our values and a shameful abdication of our oath of office to protect the American people."

'All about politics'

Trump's repeated attacks appear to be aimed at galvanizing his mostly white electoral base ahead of the 2020 presidential vote -- while also stoking divisions among his political opponents.

"See you in 2020!" said Trump, who before becoming president pushed the racist "birther" conspiracy theory that Barack Obama was not born in the United States.

Ocasio-Cortez responded on Twitter to Trump's denial that he is a racist.

"You're right, Mr. President -- you don't have a racist bone in your body," she said. "You have a racist mind in your head, and a racist heart in your chest."

While some Republican members of Congress have condemned Trump's remarks, House Republican leaders closed ranks behind the president.

"This is all about politics," said House Republican minority leader Rep. Kevin McCarthy of California.

Senator Mitch McConnell, the leader of the Republican majority in the Senate, said "the president is not a racist."

"From the president to the speaker, to the freshmen members of the House, all of us have a responsibility to elevate the public discourse," McConnell said. "Our words do matter."

Immediately after the House vote a Democratic congressman, Al Green of Texas, filed articles of impeachment against Trump.

Dozens of other Democratic members of the House have reportedly called for an impeachment inquiry to be opened against the president but Pelosi, the House speaker, has said she does not favor such a move at the moment.