A divided House voted Tuesday to condemn President Trump’s racist remarks telling four minority congresswomen to “go back” to their ancestral countries, with all but a handful of Republicans dismissing the rebuke as harassment while many Democrats pressed their leaders for harsher punishment of the president.

The imagery of the 240-to-187 vote was stark: A diverse Democratic caucus cast the president’s words as an affront to millions of Americans and descendants of immigrants while Republican lawmakers — the vast majority of them white men — stood with Trump against a resolution that rejected his “racist comments that have legitimized fear and hatred of new Americans and people of color.”

Only four Republicans broke ranks — Reps. Will Hurd (Tex.), Brian Fitzpatrick (Pa.), Susan Brooks (Ind.) and Fred Upton (Mich.) — and joined Democrats in backing the resolution. Independent Rep. Justin Amash (Mich.), who quit the GOP earlier this month, also voted for it.

Trump insisted in a string of tweets Tuesday morning that he’s not a racist — “I don’t have a Racist bone in my body!” he wrote — and the top two Republicans in Congress, Senate Majority Leader Mitch McConnell (Ky.) and House Minority Leader Kevin McCarthy (Calif.) concurred.

Trump also lashed out at the four Democratic women — Reps. Alexandria Ocasio-Cortez (N.Y.), Ilhan Omar (Minn.), Ayanna Pressley (Mass.) and Rashida Tlaib (Mich.) — for the third day in a row, accusing them of “spewing some of the most vile, hateful, and disgusting things ever said by a politician in the House or Senate.” The Republican National Committee provided a list comments to bolster Trump’s contention, but in none did the four women say they hate America, as the president has asserted.

Three of the lawmakers were born in the United States, and Omar is a naturalized U.S. citizen who was born in Somalia.

“I know racism when I see it. I know racism when I feel it. And at the highest levels of government, there is no room for racism,” Rep. John Lewis (D-Ga.), who fought for civil rights in the 1960s, said in the final minutes of the House debate.

The resolution “strongly condemns President Donald Trump’s racist comments that have legitimized and increased fear and hatred of new Americans and people of color.”

The debate played out on a raucous House floor as lawmakers attacked each other’s motives and repeatedly questioned whether their opponents had violated long-standing rules of decorum.

Democrats, led by Speaker Nancy Pelosi (D-Calif.), insisted Tuesday that they could reach no other conclusion and it was imperative to condemn, calling Trump’s comments racist — prompting Republicans to challenger her.

Pelosi said the words “are disgraceful and disgusting, and those comments are racist,” careful not to label Trump himself a racist. “How shameful to hear him continue to defend those offensive words — words that we have all heard him repeat, not only about our members, but about countless others.”

Analysis | The complete list of GOP lawmakers reacting to Trump’s “go back” tweet

Moments later, Rep. Douglas A. Collins (R-Ga.) moved to have Pelosi’s words taken down, a rarely invoked procedure that ground debate to a halt for more than an hour while the House parliamentarian examined whether they violated the chamber’s standards of decorum. On a party-line vote, her words stood.

A visibly frustrated Rep. Emanuel Cleaver II (D-Mo.), who was presiding over the House, reprimanded his colleagues, saying that despite his efforts to be fair they “don’t ever want to pass up an opportunity to escalate.”

“We just want to fight,” he said.

Tuesday’s vote was a rare occasion where members of the Republican caucus have been forced to go on the record regarding Trump’s controversial rhetoric. Since Trump has tightened his grip on the GOP, many lawmakers in his party have gone to great lengths to avoid criticizing him, fearful of the president’s wrath sinking their electoral chances.

“This resolution is harassing the president of the United States,” said freshman Rep. Dan Meuser (R-Pa.)

Democrats insisted that the vote was a test for the Congress and the nation.

“We know who he is,” Rep. Tom Malinowski (D-N.J.) said of Trump. “The question is, only question, is who are we. Are we still the country of immigrants?”

Earlier in the debate, there was another tense moment when Rep. Sean P. Duffy (R-Wis.), his voice raised, drew a reproach from Rep. Pramila Jayapal (D-Wash.) over his comments that the four congresswomen at the center of Trump’s tweets are “anti-American.”

“I’ve looked closely at the chain of three tweets, I see nothing that references anybody’s race, I don’t see anybody’s names,” Duffy said, “but the president is referring to people, congresswomen, who are anti-American. And lo and behold everyone in this chamber knows who he is talking about.”

Jayapal called the comments “defamatory,” and asked that Duffy’s words be taken down, but after some back and forth relinquished her request, but said, “it was completely inappropriate to tell any of us we are anti-American.”

Trump’s series of tweets and comments began Sunday when the president said the four Democrats should “go back” to “the crime infested places from which they came.”

With his tweets Tuesday, Trump made clear that he didn’t want Republicans to support the resolution. Doing so, he said, would “show ‘weakness.’ ”

McCarthy said during a morning news conference he would vote against the resolution and encourage other Republicans to vote against it as well. McCarthy said he did not consider Trump’s tweets to be racist, but about “socialism versus freedom.”

In his latest tweets, Trump accused the four lawmakers of being “Horrible anti-Israel, anti-USA, pro-terrorist” and took issue with the “public shouting of the F . . . word, among many other terrible things.”

Speaking to reporters at the end of a Cabinet meeting at the White House on Tuesday afternoon, he held up some papers and claimed to have “a list of things here said by the congresswomen that is so bad, so horrible that I almost don’t want to read it.”

Asked where the four House Democratic congresswomen should go if they did leave the United States, Trump said “wherever they want, or they can stay.”

“But they should love our country. They shouldn’t hate our country,” he said.

All four lawmakers have called for Trump’s impeachment, and Tlaib has done so using profane language.

Trump frequently used profanity at his campaign rallies, including one in Portsmouth, N.H., in February 2016 when he said that companies that have relocated overseas for more favorable tax rates can “go f--- themselves.”

Congressional Republicans were largely silent Sunday after Trump’s initial tweets — with some fearful of chastising a president popular with the party’s base — although a handful began speaking out critically Monday.

Addressing reporters at the Capitol on Tuesday afternoon, McConnell said that “the president is not a racist” but declined to directly answer repeated questions about whether his tweets were racist.

McConnell said everyone involved should “lower this incendiary rhetoric” and that it would be a mistake “to single out any segment of this.”

The rebuke of Trump presents an opportunity for the Democratic caucus to unite around a common aim at a time when there has been infighting between Pelosi and the four liberal lawmakers informally known as “the Squad” on Capitol Hill.

Several Democratic lawmakers said Tuesday that while they supported the resolution backed by House leaders, they were interested in a more forceful response — such as a censure resolution introduced by Rep. Steve Cohen (D-Tenn.) and supported by the four liberal freshmen.

“I think there’s going to be a number of responses, and frankly I think what the president did was so egregious I think all of the responses are good,” said Rep. Karen Bass (D-Calif.), chair of the Congressional Black Caucus. “So we’ll see what happens.”

Rep. Al Green (D-Tex.) said he will file articles of impeachment against Trump on Tuesday night, triggering a contentious vote in the coming days to confront an issue that has bitterly divided the Democratic Party.

Green’s move will force House Democrats to deal with the issue in the near term because of the privileged nature of the resolution. Under House rules, Democratic leadership can decide to try to table the impeachment articles, effectively killing them for now and risk criticism from the party’s liberal base; refer them to the House Judiciary Committee for possible consideration; or allow the vote to proceed.

If leaders do nothing, Green can force a vote on the impeachment articles in two legislative days.

House Rule Committee Chairman Jim McGovern (D-Mass.), a close Pelosi ally, said he was “not opposed” to censure but wanted to keep the focus of the day on the resolution so members can express their “deep reservations of concern on the House floor.”

“Look, this is an important vote we’re going to have today. This is the first time that I can recall that we’re actually … condemning the president for his words, which were racist, and it’s disgusting,” he said. “This is not normal. This is so divisive.”

Rachael Bade, Ashley Parker and Erica Werner contributed to this report.