Colorado’s Supreme Court has ruled that Donald Trump cannot run for president next year in the state, citing a constitutional insurrection clause.

The court ruled 4-3 that Mr Trump was not an eligible candidate because he had engaged in an insurrection over the US Capitol riot nearly three years ago.

It does not stop Mr Trump running in the other states and his campaign says it will appeal to the US Supreme Court.

The decision, they said, was “completely flawed”.

The ruling only mentions the state’s primary election on 5 March, when Republican voters will choose their preferred candidate for president. But it could affect the general election in Colorado next November.

It is the first ever use of Section 3 of the US Constitution’s 14th Amendment to disqualify a presidential candidate.

Tuesday’s decision – which has been placed on hold pending appeal until next month – only applies in Colorado. Similar attempts to kick Mr Trump off the ballot in New Hampshire, Minnesota and Michigan have failed.

The justices wrote in their ruling: “We do not reach these conclusions lightly. We are mindful of the magnitude and weight of the questions now before us.

“We are likewise mindful of our solemn duty to apply the law, without fear or favor, and without being swayed by public reaction to the decisions that the law mandates we reach.”

The decision reverses an earlier one from a Colorado judge, who ruled that the 14th Amendment’s insurrection ban did not apply to presidents because the section did not explicitly mention them.

That same lower court judge also found that Mr Trump had participated in an insurrection in the US Capitol riot. His supporters stormed Congress on 6 January 2021 while lawmakers were certifying President Joe Biden’s election victory.

The Colorado Supreme Court’s decision does not go into effect until 4 January 2024. That is the eve of the deadline for the state to print its presidential primary ballots.

Steven Cheung, a spokesman for the Trump campaign, called the ruling “completely flawed” and lambasted the justices, who were all appointed by Democratic governors.

“Democrat Party leaders are in a state of paranoia over the growing, dominant lead President Trump has amassed in the polls,” Mr Cheung said in a statement.

“They have lost faith in the failed Biden presidency and are now doing everything they can to stop the American voters from throwing them out of office next November.”

Mr Cheung added that Mr Trump’s legal team would “swiftly file an appeal” to the US Supreme Court, where conservatives hold a 6 to 3 majority.

Representatives for Mr Biden’s re-election bid declined to comment on the Colorado ruling. But a senior Democrat affiliated with the campaign told CBS News, the BBC’s US partner, that the decision would help Democrats by supporting their argument that the US Capitol riot was an attempted insurrection.

The source said it would also aid Democrats in showcasing “the stark differences” between Mr Trump and Mr Biden.

Republican lawmakers condemned the decision, including House of Representatives Speaker Mike Johnson, who called it “a thinly veiled partisan attack”.

“Regardless of political affiliation, every citizen registered to vote should not be denied the right to support our former president and the individual who is the leader in every poll of the Republican primary,” he said.

On the campaign trail Mr Trump’s Republican primary rivals also assailed the ruling, with Vivek Ramaswamy pledging to withdraw his name from the ballot if Mr Trump’s candidacy is not reinstated.

Mr Trump, speaking at a campaign event in Iowa on Tuesday night, did not address the ruling. But a fundraising email sent by his campaign to supporters said “this is how dictatorships are born”.

The Colorado Republican Party also responded, saying it would withdraw from the state’s primary process if the ruling was allowed to stand.

Citizens for Responsibility and Ethics in Washington (Crew), the group that brought the case, welcomed the ruling.

“It is not only historic and justified, but is necessary to protect the future of democracy in our country,” the group’s president, Noah Bookbinder, said in a statement.

The 14th Amendment was ratified after the American Civil War. Section 3 was intended to block secessionists from returning to previous government roles once southern states re-joined the Union.

It was used against Confederate president Jefferson Davis and his vice-president Alexander Stephens, both of whom had served in Congress. It has seldom been invoked since.

Mr Trump lost the state of Colorado by a wide margin in the last presidential election. But if courts in more competitive states followed suit on Tuesday’s ruling, Mr Trump’s White House bid could face serious problems.

During a one-week trial in Colorado last month, the former president’s lawyers argued he should not be disqualified because he did not bear responsibility for the US Capitol riot.

But in its ruling, the Colorado Supreme Court majority disagreed.

They said Mr Trump’s messages before the riot were a “call to his supporters to fight and… his supporters responded to that call”.

Carlos Samour, one of three justices who dissented, argued the government could not “deprive someone of the right to hold public office without due process of law”.

“Even if we are convinced that a candidate committed horrible acts in the past – dare I say, engaged in insurrection – there must be procedural due process before we can declare that individual disqualified from holding public office,” he wrote.

Mr Trump is facing four criminal cases, including one federal and one state case in Georgia related to his alleged election subversion efforts.