Democrat Doug Jones was certified Thursday by Alabama’s secretary of state as the winner of the state’s Senate race, less than an hour after a judge rejected Republican nominee Roy Moore’s last-ditch attempt to challenge the election results.

Earlier Thursday, Moore’s campaign alleged potential election fraud and asked a circuit judge for a restraining order to stop Alabama's canvassing board from certifying Jones' victory.

A judge then denied the request, leading Alabama Secretary of State John Merrill to certify Jones’ victory.

Jones, who will be sworn in Jan. 3, celebrated the certification and vowed to be “an independent voice” for Alabama.

"I am looking forward to going to work for the people of Alabama in the new year," Jones said in a statement. "As I said on election night, our victory marks a new chapter for our state and the nation."

DOUG JONES WINS IN MAJOR UPSET, ROY MOORE WON'T YET CONCEDE

Jones won more than 20,000 votes than Moore in the Dec. 12 election, becoming the first Democrat to win election to the Senate from the deeply conservative state in 25 years.

In a statement after Jones’ certification, Moore did not concede the race but claimed it had been a "fraudulent election.”

"I have stood for the truth about God and the Constitution for the people of Alabama,” Moore said. "I have no regrets. To God be the glory."

A Democrat winning the special election for the seat to replace Attorney General Jeff Sessions was seen as just a remote possibility several months ago.

But Jones, a Birmingham attorney famous for prosecuting the KKK, caught a break after Moore was overwhelmed in recent weeks with multiple allegations of past sexual misconduct. Moore, the former chief justice of Alabama’s Supreme Court, faced accusations he pursued romantic relationships with teenage girls while he was in his thirties.

He has denied the claims.

Moore's attorney wrote in the wide-ranging complaint that he believed there were irregularities during the election, including that voters may have been brought in from other states. He attached a statement from a poll worker that she had noticed licenses from Georgia and North Carolina as people signed in to vote.

The complaint also noted the higher-than-expected turnout in the race, particularly in Jefferson County, and said Moore's numbers were suspiciously lower than straight-ticket Republican voting in about 20 Jefferson County precincts. The complaint asked for a fraud investigation and eventually a new election.

Merrill said he has so far not found any evidence of voter fraud, but he has said that his office will investigate any complaint Moore submits.

Fox News’ Griff Jenkins and The Associated Press contributed to this report.