Former President Donald J. Trump’s rivals in the Republican race for president again lined up in his defense on Thursday after Maine barred him from its primary election ballot, the second state to do so.

When the Colorado Supreme Court barred Mr. Trump from the primary ballot there last week, all of Mr. Trump’s opponents also criticized the decision, rather than using it as an avenue of attack.

Gov. Ron DeSantis of Florida and Vivek Ramaswamy, the entrepreneur, made much the same arguments on Thursday night.

“It opens up Pandora’s box,” Mr. DeSantis said on Fox News after the Maine decision was announced. “Can you have a Republican secretary of state disqualify Biden from the ballot?”

Mr. DeSantis had previously suggested that the ruling in Colorado had been part of a plot to solidify Republican support behind Mr. Trump in the primary. He had also said that Mr. Trump’s criminal indictments had “sucked all the oxygen” out of the race.

Mr. Ramaswamy, the candidate who ostensibly is running against Mr. Trump but has most enthusiastically defended the former president, again said he would withdraw from the primary in any state where Mr. Trump was not on the ballot. He also called on the G.O.P. field — Mr. DeSantis, former Gov. Nikki Haley of South Carolina and former Gov. Chris Christie of New Jersey — to make a similar pledge.

“This is what an actual threat to democracy looks like,” Mr. Ramaswamy said in a statement. “The system is hellbent on taking this man out, the Constitution be damned.”

A statement from the Haley campaign said that “Nikki will beat Trump fair and square. It should be up to voters to decide who gets elected.”

A spokesman for Mr. Christie’s campaign pointed to his previous criticism of the Colorado ruling. Mr. Christie said at the time that a court should not exclude a candidate from the ballot without a trial that included “evidence that’s accepted by a jury.” He has also said that Mr. Trump should be defeated at the ballot box.

Other Republicans moved quickly to express their outrage on Thursday. Representative Elise Stefanik of New York, the No. 4 Republican in the House, called Mr. Trump’s removal from the ballot in Maine “election interference, voter suppression and a blatant attack on democracy.”

Reaction from Maine’s congressional delegation was split. Senator Susan Collins, the lone Republican, said the decision, which she said would “deny thousands of Mainers the opportunity to vote for the candidate of their choice,” should be overturned. Senator Angus King, an independent who caucuses with Democrats, did not immediately respond to a request for comment.

Representative Jared Golden, a Maine Democrat who is likely to face a close re-election bid, said he disagreed with the decision, arguing that Mr. Trump had not been found guilty of the crime of insurrection and therefore should remain on the ballot. Mr. Golden’s seat has been rated a tossup in an analysis by The Cook Political Report.

“I voted to impeach Donald Trump for his role in the Jan. 6 insurrection. I do not believe he should be re-elected as president of the United States,” Mr. Golden said in a statement. “However, we are a nation of laws, therefore, until he is actually found guilty of the crime of insurrection, he should be allowed on the ballot.”

Representative Chellie Pingree, who is in a safe Democratic seat in Maine’s other congressional district, said she supported the state’s decision.

“The text of the 14th Amendment is clear. No person who engaged in an insurrection against the government can ever again serve in elected office,” Ms. Pingree said in a statement, adding that “our Constitution is the very bedrock of America and our laws and it appears Trump’s actions are prohibited by the Constitution.”