Washington — After a bitter partisan brawl, House lawmakers on Tuesday approved a resolution to formally denounce President Trump's recent tirade against four progressive congresswomen of color, with four Republicans joining Democrats to rebuke the president.

The measure passed by a vote of 240 to 187, with every Democratic member voting in favor. The four Republicans who voted to approve the measure were Reps. Will Hurd of Texas, Brian Fitzpatrick of Pennsylvania, Fred Upton of Michigan and Susan Brooks of Indiana.

Before the final vote, Democrats went to extraordinary lengths to defend House Speaker Nancy Pelosi, who drew objections from Republicans after calling the president's comments about Reps. Alexandria Ocasio-Cortez, Rashida Tlaib, Ayanna Pressley and Ilhan Omar "disgraceful" and "racist" from the House floor. Her remarks prompted Republican Rep. Doug Collins of Georgia to ask Pelosi if she wished to rephrase her remarks.

Get Breaking News Delivered to Your Inbox

After Pelosi declined, Collins asked for a motion to strike down her words, arguing they violated guidelines governing debate in the House, which prohibit members from referring to the president as a racist or saying he "made a bigoted or racist statement."

A dramatic debate ensued on the floor. Democratic Rep. Emanuel Cleaver of Missouri, who was serving as chair, slammed his gavel on the dias and stormed out of the House chamber before saying, "I abandon the chair."

Soon after, the second-highest Democrat in the House, Rep. Steny Hoyer of Maryland, said the chamber's parliamentarian determined Pelosi's comments were "not in order," and the speaker was barred from speaking on the floor for the rest of the day.

Republicans forced a vote to try to strike Pelosi's comments from the record. That effort failed by a vote of 190 to 232. Democrats then proceeded to a motion to restore Pelosi's right to speak, which easily passed.

Mr. Trump tweeted late Tuesday night about the vote and the ruckus that preceded it, saying, "So great to see how unified the Republican Party was on today's vote concerning statements I made about four Democrat Congresswomen. If you really want to see statements, look at the horrible things they said about our Country, Israel, and much more. They are now the top, most visible members of the House Democrats, who are now wedded to this bitterness and hate. The Republican vote was 187-4. Wow! Also, this was the first time since 1984 that the Speaker of the House was ruled Out of Order and broke the Rules of the House. Quite a day!"

The resolution that provoked the byzantine dispute states that 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 by saying that our fellow Americans who are immigrants, and those who may look to the President like immigrants, should 'go back' to other countries."

It asserts that the House "believes that immigrants and their descendants have made America stronger, and that those who take the oath of citizenship are every bit as American as those whose families have lived in the United States for many generations."

Speaking to Democratic members in a closed-door meeting Tuesday, Pelosi said "we are offended by what he said about our sisters," according to a Democratic aide attending the meeting.

"He says that about people every day, and they feel as hurt as we do about somebody in our family having this offense against them," she said. "So this is a resolution based in who we are as a people, as well as a recognition of the unacceptability of what his goals were."

On Tuesday morning Mr. Trump again defended his earlier comments and condemned the impending vote in a series of tweets.

"Those Tweets were NOT Racist. I don't have a Racist bone in my body! The so-called vote to be taken is a Democrat con game. Republicans should not show 'weakness' and fall into their trap," Mr. Trump tweeted.

On Sunday, Mr. Trump had targeted Ocasio-Cortez, Tlaib, Pressley and Omar in a series of tweets, writing that the representatives — three of whom were born in the U.S., and all American citizens — should "go back and help fix the totally broken and crime infested places from which they came."

In a letter to her Democratic colleagues on Monday, House Speaker Nancy Pelosi wrote that Mr. Trump "went beyond his own low standards using disgraceful language about Members of Congress," and she said that "[t]he House cannot allow the President's characterization of immigrants to our country to stand." The resolution is co-sponsored by Rep. Tom Malinowski, who Pelosi noted in her letter, was born abroad, and Rep. Jamie Raskin. Currently, there are 11 naturalized citizens serving in Congress.

Ocasio-Cortez, Tlaib, Pressley and Omar held a press conference Monday evening to address Mr. Trump's tweets. "He would love nothing more than to divide our country based on race, religion, gender, orientation or immigration status, because this is the only way he knows he can prevent the solidarity of us working together," Omar, a citizen who migrated to the U.S. as a Somalian refugee, said.

Some House Republicans defended Mr. Trump's comments on Tuesday. When asked directly "is the president racist," House Minority Leader Kevin McCarthy responded, "No." And he added that he would vote against the resolution.

On broader questions about whether the GOP has been too slow to condemn the tweets, McCarthy said: "We are the party of Lincoln."

Mr. Trump defended himself on Monday, too, telling reporters at the White House that he didn't think the tweets were racist.

"If you're not happy here then you can leave as far as I'm concerned. If you hate our country, if you're not happy here, you can leave," he said at a White House event.

"And that's what I say all the time, that's what I said in tweet, which I guess some people think is controversial. A lot of people love it, by the way. But if you're not happy in the U.S., if you're complaining all the time, very simply, you can leave. You can leave right now. Come back if you want. Don't come back – it's okay, too. But if you're not happy, you can leave."

Rebecca Kaplan contributed reporting.