LGBT groups are cheering the results of a special Senate election in Alabama in which voters elected their first Democratic senator in 25 years.

The Associated Press called the race for Doug Jones two-and-a-half hours after polls closed in the state. With 91 percent of precincts reporting, Jones, a former U.S. attorney, received 49.5 percent of the vote, while Republican Roy Moore received 48.9 percent.

POLITICO called the defeat of Moore, an evangelical Christian, an “Alabama earthquake” and a “huge blow” for President Donald Trump and his former strategist Steve Bannon, both of whom supported Moore. (While Trump backed outgoing Senator Luther Strange in the primary, he threw his support behind Moore in recent weeks.)

“I am truly overwhelmed,” Jones told supporters. “At the end of the day, this entire race has been about dignity and respect. This campaign has been about the rule of law. This campaign has been about common courtesy and decency.”

“Congratulations to Doug Jones on a hard fought victory,” Trump tweeted. “The write-in votes played a very big factor, but a win is a win. The people of Alabama are great, and the Republicans will have another shot at this seat in a very short period of time. It never ends!”

Moore's huge lead shrank after several women accused the former Alabama Supreme Court chief justice of sexual assault and other misconduct when he was in his 30s.

Last month, Moore blamed the LGBT community for those allegations, saying that he's the victim of a “conspiracy” to derail his political career, which he blamed on “liberals, lesbians, gays, bisexuals, transgenders and socialists.”

During his campaign, Moore called on Congress to impeach the federal judge who blocked President Donald Trump's ban on transgender troops and to boot from the bench the Supreme Court justices who found in Obergefell that gay and lesbian couples have a constitutional right to marry. He also recently said that “transgenders don't have rights.”

The Human Rights Campaign (HRC), the nation's largest LGBT rights advocate, cheered Jones' win in an email to supporters. “The people of Alabama elected Doug Jones, an ally with a track-record of fighting hate head-on,” wrote Ben Needham, director of HRC's Project One America.

Masen Davis, CEO of Freedom for All Americans, added: “LGBT people around the country will be happily celebrating the results of today's election in Alabama, where Roy Moore, one of the most fervently anti-LGBT forces in the country, has been defeated. Moore demonstrated overwhelming contempt for LGBT people and an inability to treat us with basic respect and dignity. Tonight's election results prove that discrimination doesn't win political races. It's heartwarming to know that Alabamans will have a friend in the Senate who stands on the right side of history."

Moore was twice removed as chief justice of the Alabama Supreme Court for defying federal court orders that conflicted with his religious beliefs, including defying the Supreme Court on marriage equality after it struck down state marriage bans nationwide.

Jones will hold former Senator Jeff Sessions' seat until 2020, when Sessions' old term expires.