WASHINGTON — In a remarkable political repudiation, the Democratic-led House voted Tuesday night to condemn President Donald Trump’s “racist comments” against four congresswomen of color, despite protestations by Trump’s Republican congressional allies and his own insistence he hasn’t “a racist bone in my body.”

Two days after Trump tweeted that four Democratic freshmen should “go back” to their home countries — though all are citizens and three were born in the U.S.A. — Democrats muscled the resolution through the chamber by 240-187 over strong GOP opposition. The rebuke was an embarrassing one for Trump, and he had appealed to GOP lawmakers not to go along, but there were four Republican votes for the resolution.

The measure carries no legal repercussions for the president and the vote was highly partisan, unlikely to cost him with his die-hard conservative base.

Before the showdown roll call, Trump characteristically plunged forward with time-tested insults. He accused his four outspoken critics of “spewing some of the most vile, hateful and disgusting things ever said by a politician” and added, “If you hate our Country, or if you are not happy here, you can leave!” — echoing taunts long unleashed against political dissidents rather than opposing parties’ lawmakers.

The president was joined by House Minority Leader Kevin McCarthy of California and other top Republicans in trying to redirect the focus from Trump’s original tweets, which for three days have consumed Washington and drawn widespread condemnation. Instead, they tried playing offense by accusing the four congresswomen — among the Democrats’ most left-leaning members and ardent Trump critics — of socialism, an accusation that’s already a central theme of the GOP’s 2020 presidential and congressional campaigns.

Even after two-and-a-half years of Trump’s turbulent governing style, the spectacle of a president futilely laboring to head off a House vote essentially proclaiming him to be a racist was extraordinary.

Underscoring the stakes, Republicans formally objected after Speaker Nancy Pelosi of California said during a floor speech that Trump’s tweets were “racist.” Led by Rep. Doug Collins of Georgia, Republicans moved to have her words stricken from the record, a rare procedural rebuke.

After a delay exceeding 90 minutes, No. 2 House Democrat Steny Hoyer of Maryland ruled that Pelosi had indeed violated a House rule against characterizing an action as racist. Hoyer was presiding after Rep. Emanuel Cleaver of Missouri stormed away from the presiding officer’s chair, lamenting, “We want to just fight,” which he apparently aimed at Republicans. Despite Hoyer’s ruling, Democrats flexed their muscle and the House voted afterward by party-line to leave Pelosi’s words intact in the record.

Some rank-and-file GOP lawmakers have agreed that Trump’s words were racist, but on Tuesday party leaders insisted they were not and accused Democrats of using the resulting tumult to score political points. Among the few voices of restraint, Senate Majority Leader Mitch McConnell said Trump wasn’t racist, but he also called on leaders “from the president to the speaker to the freshman members of the House” to attack ideas, not the people who espouse them.

”There’s been a consensus that political rhetoric has gotten way, way heated across the political spectrum,” said the Republican leader from Kentucky, breaking his own two days of silence on Trump’s attacks.

Hours earlier, Trump tweeted, “Those Tweets were NOT Racist. I don’t have a Racist bone in my body!” He wrote that House Republicans should “not show ‘weakness’” by agreeing to a resolution he labeled “a Democrat con game.”

Rep. Alexandria Ocasio-Cortez of New York, one of Trump’s four targets, returned his fire.

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

The four-page Democratic resolution said the House “strongly condemns President Donald Trump’s racist comments that have legitimized and increased fear and hatred of new Americans and people of color.” It said Trump’s slights “do not belong in Congress or in the United States of America.”

All but goading Republicans, the resolution included a full page of remarks by President Ronald Reagan, who is revered by the GOP. Reagan said in 1989 that if the U.S. shut its doors to newcomers, “our leadership in the world would soon be lost.”

Republican leaders lobbied GOP lawmakers hard to oppose the resolution.

McCarthy called the measure “all politics,” and No. 3 House GOP leader Liz Cheney of Wyoming said the four Democrats “are wrong when they attempt to impose the fraud of socialism on the American people.”

The showdown came after years of Democrats bristling over anti-immigrant and racially incendiary pronouncements by Trump. Those include his kicking off his presidential campaign by proclaiming many Mexican migrants to be criminals and asserting there were “fine people” on both sides at a 2017 neo-Nazis rally in Charlottesville, Virginia, that turned deadly.

And the strong words in Washington come as actions are underway elsewhere: The administration has begun coast-to-coast raids targeting migrants in the U.S. illegally and has newly restricted access to the U.S. by asylum seekers.

Trump’s criticism was aimed at four freshman Democrats who have garnered attention since their arrival in January for their outspoken liberal views and thinly veiled distaste for Trump: Ocasio-Cortez and Reps. Ilhan Omar of Minnesota, Ayanna Pressley of Massachusetts and Rashida Tlaib of Michigan. All were born in the U.S. except for Omar, who came to the U.S. as a child after fleeing Somalia with her family.

The four have been in an increasingly personal clash with Democratic Speaker Pelosi, too, over how assertively the House should be in trying to restrain Trump’s ability to curb immigration. But if anything, Trump’s tweets have served to ease some of that tension, with Pelosi telling Democrats at a closed-door meeting Tuesday, “We are offended by what he said about our sisters,” according to an aide in the room who described the private meeting on condition of anonymity.

That’s not to say that all internal Democratic strains are resolved.

The four rebellious freshmen joined Rep. Steven Cohen of Tennessee and a handful of others who wanted the House to vote on a harsher censure of Trump’s tweets. And Rep. Al Green of Texas was trying to force a House vote soon on whether to impeach Trump — a move he’s tried in the past but lost, earning opposition from most Democrats.

At the Senate Republicans’ weekly lunch Tuesday, Trump’s tweets came up and some lawmakers were finding the situation irksome, participants said. Many want the 2020 campaigns to focus on progressive Democrats’ demands for government-provided health care, abolishing the federal Immigration and Customs Enforcement agency and other hard-left policies.

”Those ideas give us so much material to work with and it takes away from our time to talk about it,” Sen. Mike Braun of Indiana said of the Trump tweets.