(Getty)

Democrat and LGBT equality advocate Doug Jones has officially been declared winner of Alabama’s senate election.

Despite a stunning victory on election day, almost three weeks ago, Mr Jones’ win had been held up as his opponent declined to accept the result.

Disgraced Republican Roy Moore spent weeks refusing to concede defeat – citing unfounded claims of election fraud – after losing the Alabama special election.

Moore also attempted to blame gay people for his election law in a bizarre anti-gay rant.

Mr Moore had been expected to win the conservative state but he was dogged by allegations of child sexual misconduct.

The former Alabama supreme court judge attempted to launch a lawsuit, filed late on Wednesday, alleging that there were voting irregularities in 20 precincts, which amounted to “systemic election fraud”.

Now the lawsuit has been dismissed by a judge – declaring Doug Jones the victor.

A spokesperson for Doug Jones’ campaign, Sam Coleman, called the lawsuit a “desperate attempt by Roy Moore to subvert the will of the people”.

Mr Jones will be sworn in by Vice-President Mike Pence on 3 January.

Moore – who believes gay sex should be illegal – was the GOP candidate for Alabama’s US Senate seat last month, but lost the election in a surprise upset after the string of child molestation claims.

Despite losing the election by more than 20,000 votes (1.5%) Moore has continued to refuse to concede, posting a surreal video in which he appeared to blame gay people for his election defeat.

In the last ditch lawsuit, now rejected, Moore cited rumours of electoral fraud – which have already been investigated and proven to be false – as his basis for demanding a fresh election.

The disgraced Republican filed action to “postpone the certification of Alabama’s Special Election by Secretary of State John Merrill until a thorough investigation of potential election fraud”, that he claims “improperly altered the outcome of this election” – despite the wide margin of Jones’ victory.

Moore also claimed that “he successfully completed a polygraph test confirming the representations of misconduct made against him during the campaign are completely false”.

He said: “It’s appalling that the Democrat Senate Majority PAC and the Republican Senate Leadership Fund both spent millions to run false and malicious ads against me in this campaign.

“This is not a Republican or Democrat issue as election integrity should matter to everyone.

“We call on Secretary of State Merrill to delay certification until there is a thorough investigation of what three independent election experts agree took place: election fraud sufficient to overturn the outcome of the election.”

Moore has openly admitted that he thinks “homosexual conduct should be illegal”, and has also compared gay sex to bestiality, saying: “Just because it’s done behind closed doors, it can still be prohibited by state law.”

In a sinister move last week, Moore shared an article about Senator-elect Doug Jones’ gay son on social media.

Moore did not post a message alongside the link, but his supporters heard the dog whistle loud and clear – posting a string of homophobic abuse aimed at Carson Jones.

One wrote: “Well the way I see it if god wanted us to be with men on men and women on women and black with white he would have put us on earth that way guess what we are not that way it was Adam and Eve not Adam and Steve so with that said don’t push it on me I get sick and tried of hearing this crap.

“Just like Obama and the dem’s always trying to push it on us letting men go to girls bathroom just because one day they wake up and say o today I am a woman but to some that is ok well not by me it is not ok I don’t stand for it.”

The Daily Beast points out that the disgraced candidate should probably not be one to throw stones at other people’s families.

Moore’s own son Caleb has been arrested nine times, which Jones was decent enough to not bring up during the campaign.

The Facebook post was apparently a bridge too far for some of his supporters.

One wrote: “I supported you during the campaign. I defended you in discussions with friends and family. But I have to tell you, this is a cheap shot.

“It is unbecoming of a senatorial candidate to attack the family of your political opponent in my opinion. Just concede and go away. The Alabama GOP will just have to nominate a better candidate for 2020.”

Another added: “Judge Moore should have won, but who cares if Jones has a gay son? You can be sure God loves him as much as any of the rest of us. Let’s not be hypocritical people.”

The candidate’s Facebook page continues to refer to him as “Judge Roy Moore”, a title he has no claim to as a disgraced former judge who was sacked over an illegal anti-gay marriage crusade.

As Alabama’s Chief Justice Moore had abused his authority in a bid to block gay weddings in the state, issuing orders declaring the US Supreme Court ruling on equal marriage “doesn’t apply” in Alabama, and ordered probate judges to enforce a gay marriage ban.

He was ejected from his role after an ethics investigation found he had abused his power.