MONTGOMERY, Ala. (AP) — Alabama Democrat Doug Jones has been officially declared the winner of a U.S. Senate race after a judge rejected Republican Roy Moore’s last-ditch effort to stop the certification of Jones’ historic upset in a deep-red state.

Montgomery Circuit Judge Johnny Hardwick denied Moore’s request for a restraining order to stop Alabama’s canvassing board from certifying Jones’ victory on Thursday.

Alabama Secretary of State John Merrill said Jones has been certified the winner of the Dec. 12 election. He will be sworn in on Jan. 3.

A spokesman for Jones earlier called Moore’s action a “desperate attempt ... to subvert the will of the people.”

“The election is over. It’s time to move on,” Sam Coleman wrote in an email.

Jones defeated Moore by about 20,000 votes. Moore’s campaign was deeply wounded by accusations of sexual misconduct involving teenage girls decades ago. Moore denied the accusations and said he has taken and passed a polygraph test to prove they are false.

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.

“This is not a Republican or Democrat issue as election integrity should matter to everyone,” Moore said in a statement Wednesday.

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.