In a ruling that kicks at the foundation of how America chooses presidents, a federal appeals court on Tuesday said members of the Electoral College, who cast the actual votes for president, may choose whomever they please regardless of a state’s popular vote.

The ruling by the United States Court of Appeals for the 10th Circuit in Denver said Colorado was out of bounds in 2016 when it canceled the vote of a so-called faithless elector named Michael Baca. Mr. Baca, a Democrat, wrote in the name of John Kasich, a Republican who was Ohio’s governor at the time, even though Hillary Clinton carried Colorado, earning its nine electoral votes. The secretary of state replaced Mr. Baca with another elector who then voted for Mrs. Clinton.

“The text of the Constitution makes clear that states do not have the constitutional authority to interfere with presidential electors who exercise their constitutional right to vote for the president and vice president candidates of their choice,” the court majority wrote in a split ruling by a three-judge panel.

[Sign up for our politics newsletter and join the conversation around the 2020 presidential race.]

Lawrence Lessig, a Harvard law professor who founded the group that brought the case, Equal Citizens, said it was the first time a federal appeals court had ruled on whether electors could be bound in how they vote. Many states, including Colorado, have laws requiring electors to pledge that they will support the winner of the popular vote. The Constitution is mute on the subject. The appeals court noted that a handful of faithless electors have broken pledges to vote with their state’s majority since the presidential election of 1796.