DURHAM, N.C.—Governor Pat McCrory has conceded the North Carolina gubernatorial race to Democrat Roy Cooper, ending the nation’s longest-running governor’s race.

McCrory announced his decision in a video posted at about noon on Monday.

“Being the 74th governor of North Carolina has been a privilege and an honor, but during this wonderful season it’s also time to celebrate our democratic process and respect what I see to be the ultimate outcome of the closest North Carolina governor’s race in modern history,” he said. “Despite continued questions that should be answered regarding the voting process, I personally believe that the majority of our citizens have spoken and we now should do everything we can to support the 75th governor of North Carolina, Roy Cooper.”

McCrory pledged that his team would assist Cooper, who is currently the state attorney general, in his transition. Cooper issued a statement thanking McCrory. “While this was a divisive election season, I know still that there is more that unites us than divides us,” he said.

The governor’s concession ends a protracted finish to the campaign, and it comes even as some questions remain outstanding about the race. McCrory and some of his allies had lodged a series of protests in counties around the state, alleging that there were suggestions of fraud and irregularity. McCrory had also said he intended to request a recount statewide, though his campaign later said that he would be willing to drop his call for a recount if about 94,000 early ballots in Durham County, the most contested site, were recounted.

But McCrory has experienced a series of defeats in recent days. As final counts from around the state streamed in—many delayed by wrangling over protests and challenges—Cooper’s margin of victory steadily grew, eventually eclipsing the 10,000 mark, above which McCrory was not entitled to an automatic recount. After most protests were rejected at either the county or state level, the North Carolina State Board of Elections last week ordered Durham County to hold the recount. On Saturday, the NCSBE opted not to act on the final remaining challenge, in Bladen County, though it did decide to refer the case to law enforcement.

On Sunday, Durham County’s board of election—which had reacted peevishly to orders from the state board that it saw as wasteful and baseless—announced that after recounting most of the early ballots, the results had remained almost unchanged. (Cooper gained a pair of votes.) Monday afternoon, as the country board prepared to finish counting votes, McCrory’s video emerged. The atmosphere at the Durham County board, where reporters had gathered to see results, was one of shock and relief. County Attorney Lowell Siler walked around in disbelief that the process was over. The county board must continue to count the votes, though the stakes are now greatly reduced.

“The governor was monitoring what was going on here,” said Durham attorney Thomas Stark, a Republican whose challenge had produced the recount and who said he’d been in touch with McCrory. “There’s a need for the state to move forward and the governor was acutely aware of that, and that was on his mind constantly I think.”

McCrory’s concession ends an election that was contentious even before it finished with a contested, razor-thin margin. North Carolina politics has been turned upside down in recent years, after Republicans took control of both the General Assembly, in 2010, and the governorship, in 2012, in this purple state. The GOP introduced a large slate of conservative legislation, with particular national attention falling on a strict voting law passed in 2013 and HB 2, the so-called bathroom bill on transgender restroom use passed in early 2016.

Cooper ran a two-pronged campaign, accusing McCrory of overreaching while also campaigning heavily on the importance of education. McCrory, for his part, touted the “Carolina Comeback” for the state’s economy and charged Cooper with mismanagement during his 16-year tenure as attorney general. Cooper had refused to defend several of the conservative state laws in court, which he presented as a sign of independence and wisdom and McCrory charged was dereliction of duty.

McCrory’s loss didn’t come as a complete shock—he had trailed in most polls ahead of the election—but he lost even as Donald Trump beat Hillary Clinton by a healthy margin, and as Senator Richard Burr comfortably defeated Democrat Deborah Ross to win another term.

An Atlantic review of election results shows that McCrory outperformed Trump around Charlotte, Raleigh, and Durham, but lagged his margins in Wilmington, on the coast; in the somewhat depleted manufacturing hubs of the Piedmont Triad, where Trump’s anti-free-trade platform resonated; and in Western North Carolina, where Trump’s dominance in Appalachia manifested itself. That suggests that McCrory’s brand of pro-business management with a side of social conservatism had little pull on some of Trump’s most motivated supporters. For those voters who believed the nation was on the wrong track, McCrory’s “Carolina Comeback” may not have been a winning message.

A significant amount of the blame for McCrory’s loss also falls on HB 2. The governor, a former mayor of Charlotte, initially seemed hesitant about the idea of overruling his former city, and refused to call a special session to pass it. But once social conservatives in the legislature called the session themselves, McCrory quickly signed it and positioned himself as the law’s chief defender, even though recently released emails suggest he did not fully understand the law. Backlash to the law was fierce, with musicians boycotting the states, corporations canceling job expansions, and athletic contests being moved. Some estimates suggest the law has cost the state hundreds of millions of dollars. It became a story just not of social conservatism but of questionable stewardship of the economy.

The story of HB 2 was, in a way, a microcosm of the McCrory administration. As longtime mayor of Charlotte, he ran for governor as a pro-business moderate, but he governed more as a social conservatism, in large part pushed that direction by the Republican legislature, which can and on occasion did exercise its ability to override his vetoes. My colleague Vann Newkirk has written about how Democrats rallied the “Moral Movement” coalition to oppose the conservative push on various fronts.

Cooper’s win is a blow to GOP dominance in the state, but he will face a robust Republican majority in the general assembly. As the race dragged on in November, there was speculation that McCrory and his allies might attempt to throw the election to the legislature under an obscure state law, though there’s no evidence to suggest that was ever a serious possibility.

Republicans did, however, work hard to suggest that fraud had tainted the election. The sweeping 2013 voting law was largely overturned over the summer by the Fourth Circuit Court of Appeals, which ruled that the law was intended to suppress minority votes. There is effectively no evidence of widespread voter fraud. The challenges to the race were a chance to both save McCrory’s governorship and to prove that fraud was real. There’s a certain cynicism to this line of argument. Republicans in North Carolina have spent years arguing, in the face of no evidence, that voter fraud is real, and now they’re using that belief to challenge the accuracy of elections.  “Whether there’s widespread voter fraud or not, the people believe there is,” state GOP Executive Director Dallas Woodhouse told Barry Yeoman.

Even with McCrory’s departure from the governor’s mansion imminent, his final weeks in office could be eventful. The governor has called a special session of the legislature for next week, intended to address recovery efforts from both Hurricane Matthew, which badly damaged the eastern part of the state, and wildfires currently ravaging Western North Carolina. There’s speculation that Republicans might use the occasion to try to pack the state supreme court, which swung to a one-vote Democratic advantage in November’s election. It wouldn’t be North Carolina politics in 2016 without a few more controversies.