Colorado’s nine electors have been ordered to vote for Hillary Clinton because she won the state’s popular vote - effectively stopping them from joining an effort to unite with Republicans behind a compromise presidential candidate other than Donald Trump.
Denver Judge Elizabeth Starrs also ruled that any electors who fail to do so can immediately be replaced when the Electoral College convenes on 19 December.
She responded to a request from Colorado’s secretary of state, who was seeking a way to prevent electors from diverging from the winner of the state’s popular vote.
Electors Polly Baca and Robert Nemanich had sued to overturn a state law requiring them to vote for Clinton, but a federal judge refused to do so on Monday.
There are similar lawsuits in California and Washington state which are seeking to overturn laws binding electors.
A total of 28 other states have laws binding their electors to the winner of the popular vote.
At least one other Colorado elector has said he will vote for someone other than Clinton in a bid to woo Republican electors to a different candidate, such as Mitt Romney. Only one Republican elector nationally has publicly said he would do that.
Chris Jackson, of the Colorado attorney general’s office, argued in court on Tuesday that the effort would undermine democracy.
“What we’re asking the court to do is protect against the chaos that would ensue from faithless electors failing to perform their state law duties,” he said.
Jesse Witt, an attorney for Baca and Nemanich, said he was disappointed at Starrs’ ruling and may appeal.
“We feel it is an abridgement of free speech and free expression,” he said.
Earlier, Baca and Nemanich filed an emergency appeal to the tenth US Circuit Court of Appeals to try to get it to suspend the Colorado law.
That comes after US District Judge Wiley Daniel declined to put the law on hold on Monday and called the effort “a political stunt”.
It is unclear whether the appeals court will hear the case before the electors vote, but the state judge’s order would still stand.
The Colorado electors could face up to a year in jail and a $1,000 (£786) fine if they defy the law and vote for someone other than Clinton.
Trump won 306 electors last month, well over the 270 needed to put him in the White House.