The measure, which formally rebuked the president’s comments as “racist”, was approved on a mostly partisan-line vote of 240 to 187.

The vote came days after Trump’s tweets about four newly elected Democratic lawmakers – Representatives Alexandria Ocasio-Cortez of New York, Ilhan Omar of Minnesota, Ayanna Pressley of Massachusetts, and Rashida Tlaib of Michigan – sparked a widespread uproar. Ocasio-Cortez, Pressley and Tlaib were all born in the US, while Omar is a naturalized American citizen who arrived in the country at a young age as a Somali refugee.

“Every single member of this institution, Democratic and Republican, should join us in condemning the president’s racist tweets,” the House speaker, Nancy Pelosi, said on the House floor.

“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.”