Alabama, US (BBN) - Doug Jones has become the first Democrat in 25 years to win a US Senate seat for Alabama after a bitter campaign against Republican Roy Moore.
His unexpected victory deals a blow to President Donald Trump, who backed Mr Moore, and narrows the Republican majority in the Senate to 51-49, reports BBC.
With 99% of the votes counted, Mr Moore refused to concede on Tuesday night.
He fought a controversial campaign, in which allegations surfaced of sexual misconduct with teenage girls.
Mr Moore denied the claims.
The president congratulated Mr Jones in a tweet shortly after US media declared him the winner, adding that "Republicans will have another shot at this seat in a very short period of time".
Mr Moore's campaign chairman, Bill Armistead, said it was too close to call the race despite several US outlets reporting in favour of Mr Jones.
Mr Moore himself did not concede and told his supporters it was not yet over.
"We've been painted in an unfavourable and unfaithful light," he said. "We've been put in a hole, if you will."
Mr Jones is a former lawyer known for helping convict two Ku Klux Klan members who bombed a black church in 1963 in Birmingham, killing four girls.
"This entire race has been about dignity and respect," he said in his victory speech.
"This campaign has been about the rule of law. This campaign has been about common courtesy and decency and making sure everyone in this state, regardless of which zip code you live in, is going to get a fair shake in life."
Mr Moore, a firebrand conservative, was twice removed from the state Supreme Court and believes that homosexual activity should be illegal.
He has also argued against removing segregationist language from the state constitution.
But it was allegations of sexual misconduct made by several women, some when they were teenagers, that drew national attention to the special election.
The claims against Mr Moore came amid a wave of allegations of sexual misconduct against prominent figures that has led to the resignation of three politicians.
Mr Jones wins the seat vacated by US Attorney General Jeff Sessions earlier this year.
A FLAWED CANDIDATE - OR AN ANTI-TRUMP WAVE?
Alabama will have a Democrat in the US Senate.
It's an outcome that seemed all but impossible a year ago and still seemed unlikely even as voters headed to the polls on Tuesday.
The ramifications of this unexpected victory are clear.
The Republican majority in the Senate will narrow, considerably improving the chances Democrats could gain control of the chamber in the 2018 mid-term elections.
It could also be seen as a rebuke of President Donald Trump, who gave full-throated support to Roy Moore even when other leaders in his party were hesitant.
After winning governor races in Virginia and New Jersey in November, some Democratic supporters will be hoping that an anti-Trump electoral wave is forming.
But Moore was such a flawed candidate that it may be too early to tell.
BBN/MMI/ANS