Roy Moore’s attempt to prevent his electoral challenger from being named Alabama’s next senator has failed, after a court refused his legal action to stop the process and officials certified Doug Jones as the first Democrat to be elected to the senate from the state for more than 25 years.

Since Mr Jones beat the former judge by around 22,000 votes in a stunning result two weeks ago, the Republican former judge has refused to accept the result, claiming election fraud and demanding the election be held again.

Late on Wednesday, he filed a legal action to try and stop Alabama state officials certifying Mr Jones and sending him to Washington. “This is not a Republican or Democrat issue as election integrity should matter to everyone,” Mr Moore said.

But officials were not moved. On Thursday afternoon, at a meeting of the state canvassing board, Alabama Secretary of State John Merrill certified the the election results and Governor Kay Ivey and Attorney General Steve Marshall also signed off on them.

Shortly before, Montgomery Circuit Judge Johnny Hardwick denied Mr Moore’s request to stop the process.

As a result, Mr Jones will now be sworn in on January 3, cementing his staggering victory in a heavily conservative and religious state and reducing the Republicans’ senate advantage to just 51-49. He will fill the seat made vacant by Attorney General Jeff Sessions when he joined Donald Trump’s cabinet.

Democratic U.S. Senator elect Doug Jones speaks to supporters during his election night gathering (Getty)

Mr Jones was quick to seize on his moment. “I am looking forward to going to work for the people of Alabama in the new year,” the senator-elect said in a statement. “This is a new chapter for our state and the nation.”

Reuters said a spokesman for Mr Merrill said Mr Hardwick, the judge, had denied Mr Moore’s request to block certification of the results of election in a decision shortly before the canvassing board was to meet.

Mr Moore's challenge alleged there had been potential voter fraud that denied him a chance of victory.

Janet Porter, a spokeswoman for Mr Moore’s campaign, told CNN the challenge aimed to ensure that votes were properly counted.

Bar in Alabama erupts in celebration after Roy Moore loses

Regarding the claim of voter fraud, Mr Merrill said that least 100 cases had been reported. “We’ve adjudicated more than 60 of those. We will continue to do that,” he said.

Mr Merrill, a Republican who said he had voted for Mr Moore, denied the accusations of voter fraud and said people could feel safe their ballots were recorded and counted properly.

Mr Moore, who describes himself as an evangelical Christian, had previously made international headlines when he had a 5,000lb granite statue containing the Ten Commandments placed in his court complex. He was ousted from his position as the state’s top judge after he told after members of the judiciary to ignore a US Supreme Court ruling on same-sex marriage.

Alabama Senate race: Roy Moore vs Doug Jones Show all 12 1 /12 Alabama Senate race: Roy Moore vs Doug Jones Alabama Senate race: Roy Moore vs Doug Jones Democratic senatorial candidate Doug Jones speaks to reporters after voting Getty Images Alabama Senate race: Roy Moore vs Doug Jones Republican Senatorial candidate Roy Moore (L) and his wife Kayla ride their horses to the polling station to vote AFP/Getty Images Alabama Senate race: Roy Moore vs Doug Jones David Watson waves in a Santa suit as he holds a Doug Jones sign AP Alabama Senate race: Roy Moore vs Doug Jones Republican Senatorial candidate Roy Moore speaks to the media as his wife Kayla (R) looks on AFP/Getty Images Alabama Senate race: Roy Moore vs Doug Jones Democratic Alabama Senate candidate Doug Jones casts his vote at Brookwood Baptist Church REUTERS Alabama Senate race: Roy Moore vs Doug Jones Roy Moore speaks to the media after he rode in on a horse to vote AP Alabama Senate race: Roy Moore vs Doug Jones Democratic candidate Doug Jones greets supporters after casting his ballot AP Alabama Senate race: Roy Moore vs Doug Jones Republican Senate candidate Roy Moore departs on horseback after he cast his ballot in Gallant REUTERS Alabama Senate race: Roy Moore vs Doug Jones Voters wait in line to cast their ballot at a polling station setup in the St Thomas Episcopal Church Getty Images Alabama Senate race: Roy Moore vs Doug Jones Democratic Senatorial candidate Doug Jones (L) greets voters outside of a polling station at the Bessemer Civic Center Getty Images Alabama Senate race: Roy Moore vs Doug Jones Voters exit after casting their ballots at a polling station setup in the Fire Department Getty Images Alabama Senate race: Roy Moore vs Doug Jones Democratic Alabama U.S. Senate candidate Doug Jones speaks with the media after casting his vote at Brookwood Baptist Church Reuters

Having won the Republican primary in September with the support of such “insurgent” figures as Steve Bannon, Sarah Palin and Nigel Farage, the 70-year-old appeared set to take the senate seat made vacant by Attorney General Jeff Sessions when he joined Mr Trump’s cabinet.

However, his numbers started to tumble after a number of woman came forward to accuse him of sexually abusing and assaulting them when they were teenagers and was aged in 30s and working as a local prosecutor. One of the women said she was just 14 at the time. Mr Moore staunchly denied the accusations.

Turnout for the showdown was around 40 per cent, high for a special election. It was marked by a very high number of African American women and men, turning out to vote for Mr Jones, who famously convicted two former Ku Klux Klan gang members who bombed a black church in 1963.