CHARLESTON, W.Va. (AP) — The state Supreme Court on Wednesday denied a last-minute bid by former coal CEO Don Blankenship to get his name on the ballot in November's U.S. Senate race in West Virginia.

The court upheld a decision by the secretary of state denying Blankenship's application for a third-party candidacy.

"The West Virginia Secretary of State is ordered to take whatever measures are necessary to ensure that Donald L. Blankenship does not appear on the 2018 General Election Ballot for the Office of United States Senator for the State of West Virginia," the decision said.

The court itself is in a state of upheaval. One of the judges hearing the case Wednesday was filling in for a suspended justice, and two sat in for judges who retired after lawmakers voted to impeach them over allegations of improper use of court funds.

The justices issued the decision in the form of an order, rather than an opinion that would have laid out how each one voted and included comments from a majority ruling.

In a statement, Blankenship thanked his supporters and said he will evaluate his next step with his attorneys, which could include an appeal.

"For those who believe in democracy, it is a frightening decision," he said. "Americans desperately need to pay attention as the politicians continue to move voters to the sidelines and out of the election process."

Secretary of State Mac Warner had blocked Blankenship's bid to run as the Constitution Party's nominee, based on the state's "sore loser" law. It prohibits major-party primary candidates who lose from switching to a minor party. Blankenship finished third in the Republican primary in May.

Warner said in a statement that the decision "puts the issue to rest and allows voters going to the polls to know with certainty who will be on the ballot."

He said it also validates the sore loser law, "ending any chance for those candidates thinking they will have endless bites at the same apple."

West Virginia Wesleyan political history professor Robert Rupp said he wasn't surprised by the ruling, which along with the "sore loser" law "is just evidence that they're not going to open up the system and make it easier and acceptable to those who want to run for office."

The Senate race features incumbent Democratic Sen. Joe Manchin; Republican nominee Patrick Morrisey, who is the state attorney general; and Libertarian candidate Rusty Hollen.

Asked for a response to the court's order, Morrisey said he welcomed the end of "distractions" to the Senate race.

A spokesman for Manchin's campaign didn't immediately respond to an emailed request for comment.

Blankenship argued the sore loser law was applied to him retroactively. He said lawmakers clarified the law earlier this year and it didn't become effective until June, after he had begun the process of running as a candidate for the Constitution Party.

The secretary of state's office said Blankenship didn't file a certificate of candidacy until late July.

West Virginia University law professor Robert Bastress, who represented Blankenship, said Blankenship met the requirements to run on the ballot and that any election-related statutes enacted during the election cycle "are essentially changing the rules of the game."

The justices asked several questions, including about previous case law. One noted that Blankenship could have simply run as a write-in candidate after losing in the primary.

The Supreme Court's fall term doesn't start until early October, but justices scheduled Blankenship's hearing now because the case had to be expedited to enable ballot printing and ballot approval by an early September deadline.

Chief Justice Margaret Workman and Justice Beth Walker heard the appeal, along with three circuit judges.

Paul Farrell was appointed to fill in for suspended Justice Allen Loughry, who faces an impeachment trial in the state Senate along with a federal trial over allegations including that he repeatedly lied about using his office for personal gain.

Workman appointed circuit judges Alan Moats and Darrell Pratt to fill in for Robin Davis and Menis Ketchum. Ketchum retired last month before the House of Delegates impeached the court's four other justices. He has pleaded guilty to a felony fraud count related to his personal use of a state vehicle and gas fuel card and faces up to 20 years in prison. Davis retired after she was impeached.

Blankenship is the former CEO of Massey Energy, which owned a mine where a 2010 explosion killed 29 workers. He spent a year in federal prison for safety violations related to the explosion.