One of the most hotly contested races of 2016 is still being contested. And the North Carolina governor's race could drag on past Thanksgiving in an ugly way: The Democrat is declaring victory but the Republican incumbent is refusing to concede, and his campaign is raising the possibility of voter fraud. There could even be a recount.

Attorney General Roy Cooper (D) has declared victory in his attempt to unseat embattled Gov. Pat McCrory (R).

Cooper declared victory early Wednesday with a 5,000-vote lead over McCrory out of 4.6 million votes cast. That's a 0.5 percentage point lead, and it's small enough that McCrory isn't willing to concede until thousands of provisional, absentee and military ballots are counted and the election results certified by state election officials. In fact, on Thursday afternoon, McCrory's campaign announced they hired a lawyer and set up a legal defense fund in preparation to contest the results.

North Carolina Republicans were aghast that Cooper could declare victory. The state GOP chairman, Robin Hayes, said in a statement that it was "rude and grossly premature."

On top of that, McCrory's campaign is casting doubt about how the vote got tallied in a Democratic stronghold that, at the last minute, appeared to hand Cooper the election.

Throughout election night, it was clear this race was going to be a nail-biter. As top-of-the-ticket races in North Carolina quickly got called for Republicans (Donald Trump won the state by four percentage points and Sen. Richard Burr, a Republican, won reelection), the lead between McCrory and Cooper switched back and forth pretty much every time a batch of results came in.

McCrory had taken the lead when, just before midnight, 90,000 votes came in from the Democratic stronghold Durham County that boosted Cooper to what he claimed was victory.

In Durham County, three county election officials had to count votes by hand after several of their data storage cards malfunctioned. When they finally submitted the county's 90,000 votes, McCrory's 60,000-vote lead evaporated to a 2,500 deficit. Cooper declared victory and McCrory cried foul soon after, according to the News & Observer, mentioning to supporters in a speech after midnight "the sudden emergence of over 90,000 votes" and promising to "check everything."

"To say we are a bit suspicious is an understatement," McCrory strategist Chris La Civita told The Fix on Thursday.

Now, McCrory's camp is holding out to see if they can cobble together a path to victory from the thousands of absentee and provisional and military ballots that have yet to be counted. If the race is still close after that — within 10,000 votes — either side can call for a recount. But because we have to wait for all the votes to be counted and certified, a recount probably wouldn't happen until after Thanksgiving. (McCrory's campaign declined to comment on whether they'd seek a recount in that situation.)

Democrats remain confident that they'll keep their lead when all the ballots are counted. And they think the claim that there might have been voter fraud in Durham County is ridiculous. For one, News & Observer's Virginia Bridges reported that election officials there said there was nothing to worry about.

“The total would have been the same whether it came in at 7 p.m. or it came in at midnight,” Bill Brian, chairman of the Durham County Board of Elections (and a Republican appointed by McCrory), told Bridges.

Durham County has had a history of election challenges — faulty voting machines, a precinct opening late or being moved altogether. But Democrats point out that Tuesday's gubernatorial results from Durham are consistent with past elections, with about 75 percent of votes going for the Democrat and 20 percent for Republican.

The North Carolina State Board of Elections will spend the next few weeks canvassing counties to double check the results. They'll officially certify the results in a public meeting Nov. 29 — unless there's a recount, which will stretch things out.

If Cooper wins, it will be a major coup for Democrats — a bright spot in an otherwise dismal election year for them. Defeating a sitting governor is hard to do; before Tuesday incumbent governors had won reelection in 50 of the past 53 attempts.

Cooper would also become just the third statewide Democratic candidate to win in a state Trump won. The other two were also governors — Billionaire Jim Justice won the open gubernatorial seat in West Virginia even though Trump won the state by 42 points. And Gov. Steve Bullock won reelection in Montana even though Trump took his state by 22 points.

But any victory lap for Cooper will probably be short-lived. Republicans kept their veto-proof majorities in both of North Carolina's state legislative chambers. (Nationwide, Republicans maintained their historic dominance of state politics at nearly every level.)

McCrory was undoubtedly hurt politically this year by his decision to sign into law this spring a rushed bill limiting what bathrooms transgender people could use and blocking anti-discrimination protections for LGBT people. He became the face of the LGBT culture wars for it, and Cooper's camp smartly seized on the economic impact the law's fallout was having in the state.

If McCrory loses, he'll be one of the only vulnerable, high-profile statewide Republican incumbents to fall in 2016.