Alabama officials have certified Democrat Doug Jones as the winner of the state's US Senate race, after a state judge denied a legal challenge by Republican Roy Moore, whose campaign was derailed by accusations of sexual misconduct with teenage girls.
Mr Jones won the vacant seat by about 22,000 votes, election officials said.
That made him the first Democrat in a quarter of a century to win a Senate seat in Alabama.
The seat was previously held by Republican Jeff Sessions, who was tapped by US President Donald Trump as attorney general.
Alabama Secretary of State John Merrill certified the election results at a meeting of the state canvassing board.
"I am looking forward to going to work for the people of Alabama in the new year," Senator-elect Jones said in a statement, calling his victory "a new chapter for our state and the nation."
Mr Moore declined to concede defeat even after Mr Trump urged him to do so.
A spokesman for Mr Merrill said an Alabama judge denied Moore's request to block certification of the results of the 12 December 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.
His filing yesterday in the Montgomery Circuit Court sought to halt the meeting scheduled to ratify Mr Jones' win.
Janet Porter, a spokeswoman for Moore's campaign, told CNN in an interview that the challenge aimed to ensure that votes were properly counted.
Regarding the claim of voter fraud, Mr Merrill told CNN that more than 100 cases had been reported. "We've adjudicated more than 60 of those. We will continue to do that," he said.
A day after the election, Mr Merrill said it was "highly unlikely" that Jones would not be certified as the winner.
Seating Jones will narrow the Republican majority in the Senate to 51 of 100 seats.
Republican lawmakers in Washington had distanced themselves from Moore and called for him to drop out of the race after several women accused him of sexual assault or misconduct dating back to when they were teenagers and he was in his early 30s.
Mr Moore has denied any wrongdoing.