A deeply red state has turned purple, as Alabama appears to be sending former U.S. Attorney Doug Jones to Washington as its first Democratic senator in nearly 25 years.

Unofficial results from Alabama Secretary of State John Merrill’s office show Jones bested his Republican opponent Roy Moore by more than 20,000 votes statewide, thanks in part to a substantial number of write-in ballots cast.

However, Moore has so far refused to concede the race, telling supporters at his election watch party in Montgomery that, “when the vote is this close, it’s not over.”

The photo finish in Tuesday’s race briefly put Merrill himself into the spotlight, mostly because of an Alabama law that can automatically trigger a recount when a margin of victory in an election is less than one half of one percent of the total vote.

Jones surpassed that threshold with 49.9 percent of the vote, but Merrill told CNN shortly after the Associated Press declared a victory for Jones that as more than 22,000 write-in votes are certified, it could potentially reduce the margin enough to spur that automatic recount.

“When those write-in votes are actually counted, it may change the numbers that are actually being considered authentic write-in votes today because nobody can be viewed as a write-in candidate unless they’re qualified to serve in that role,” Merrill said. “There’s always a chance of a recount because any candidate can ask for one. If they pay for it, they can receive a recount.”

Moore’s campaign also raised the point there are still outstanding provisional ballots to be counted along with ballots cast by members of the military serving overseas. However, Merrill said it would be “highly unusual and highly unlikely” for 22,000 ballots to be outstanding, though he did say those votes, once counted, could also affect the margin of Jones’ victory.

By law, the election results have to be certified between Dec. 26 and Jan. 3, a process Merrill’s office will be undertaking in the coming weeks. However, he also expressed confidence in the integrity of Alabama’s election processes, noting when recounts have occured in the recent past, the original totals only changed by “three of four votes.”

“Using the equipment we use in the elections process, there’s not a whole lot of mistakes that are made. There aren’t a whole lot of errors that occur,” Merrill said.

Tuesday’s special election has thrust Alabama into the national spotlight because of its importance in the Senate, which is barely holding a Republican majority. However, most of the recent intrigue in the campaign has been focused on allegations from Moore’s past.

Over the last month, at least nine women have levied accusations of sexual misconduct against Moore ranging from unwanted romantic attention to outright sexual assault — allegations Moore only vaguely alluded to in his brief comments after the election was called Tuesday night.

Roy Moore, U.S. Senate candidate and former Chief Justice of Alabama’s Supreme Court.

“The problem with this campaign is we’ve been painted in an unfavorable and unfaithful light. We’ve been put in a hole, if you will,” Moore said, before going on to quote scripture. “We know what we’ve got to do — just wait on God, and let this process play out.”

While Moore hasn’t conceded the race, the few Republicans who’ve publicly stood by his tumultuous campaign appear willing to. Alabama GOP Chairman Terry Lathan said Republicans were “deeply disappointed” with Tuesday’s results but would respect the voting process.

However, she warned Jones that “all eyes will be on his votes” until the election in 2020.

“Sixty percent of all partisan elected officials in our state are Republicans, and we expect a strong slate of Republican candidates in 2018 as we continue to grow our base,” Lathan wrote in an emailed statement. “Alabamians are conservative and have no intentions of moving toward the policies of the Democrat Party.”

President Donald Trump weighed in on Tuesday’s result in Alabama. (Twitter)

One of Moore’s most powerful supporters — and one of the most vocal in recent weeks — was President Donald Trump, who was quick to congratulate Jones on a “hard fought victory” on Twitter Tuesday night, while noting that Republicans would “have another shot” at the seat.

In Birmingham, the mood was far from somber at Jones’ election watch party. While a number of supporters said they weren’t surprised at the results, the jubilation there told another story.

In some of his first statements after the race was called, Jones said he was “truly overwhelmed.”

“I’ve always said the people of Alabama have more in common than what divides us, and we have shown not just the state but the whole country the way we can be unified,” Jones said. “This election has never been about me, it’s never been about Roy Moore — it’s always been about every one of you, your sons and daughters and the volunteers who knocked on 300,000 doors and made 1.2 million phone calls around the state.”

Lagniappe | U.S. Senate candidate Doug Jones met with Lagniappe’s editorial board Oct. 19, 2017.

Despite the celebration, Jones said the country is still facing important challenges related to the issues he campaigned on including health care, jobs and the economy.

He also reminded politicos outside the state that his campaign in Alabama — one that was almost certainly aided by moderate Republicans — was rooted in “finding common ground, reaching across the aisle and actually getting things done for the people.”

“I have this challenge to my future colleagues in Washington — Don’t wait on me,” Jones said. “The people of the great state of Alabama have said, ‘We want you to get something done.’”