Kentucky’s Democratic Attorney General Andy Beshear declared a stunning victory in the state’s governor race on Tuesday night. But incumbent Republican Gov. Matt Bevin has not conceded, telling supporters there were unspecified “irregularities” in the voting process and suggesting there could be a recount.

Beshear declared a narrow win over Bevin, leading by a margin of 5,150 votes with all precincts reporting. But as of Wednesday morning, the Associated Press said the race was still too close to call.

“Tonight, voters in Kentucky sent a message loud and clear for everyone to hear. It’s a message that says our elections don’t have to be about right versus left. They are still about right versus wrong,” Beshear said in his victory speech. “Our values, and how we treat each other, [are] still more important than our party. That what unites us as Kentuckians is still stronger than any national divisions.”

Bevin, meanwhile, told his supporters the race wasn’t over.

“This is a close, close race,” he said. “We want the process to be followed, and there is a process. We know for a fact that there have been more than a few irregularities.” Bevin did not immediately provide any evidence of voting fraud, and Republicans swept other state offices that were on the ballot.

Under Kentucky law, the process Bevin referenced begins with recanvassing, a procedure during which county election officials check each voting machine to confirm the ballots were counted and reported correctly. A candidate can request a recanvass within a week of the election — by Nov. 12.

In certain Kentucky elections, if a candidate is unsatisfied with that result and wants to seek a formal recount, they must file a petition to the Franklin Circuit Court within 10 days of the election and pay for the cost of a recount, which would be conducted by a state judge. The judge’s decision could then be appealed to the Kentucky Court of Appeals or the Kentucky Supreme Court. But analysis from a law professor at the University of Kentucky suggests that the recount statute does not apply to gubernatorial elections.

Instead, an election contest for governor or lieutenant governor is heard by a randomly selected committee of 11 state lawmakers, and then decided on by a joint session of the state legislature. A gubernatorial candidate must provide written notice contesting the election “within thirty days after the final action of the State Board of Elections,” according to state law.

It’s not yet clear how far Bevin plans to proceed with his objection to the election results. But under Kentucky’s constitution, the new governor is scheduled to be sworn in on Dec. 10.

Bevin, who was elected in 2015, was among the country’s most unpopular governors, in part because he lashed out at public school teachers who walked out last year over a controversial pension bill.

Bevin had closely aligned his campaign with President Donald Trump, and his apparent loss comes as a blow to the President, who hosted a rally for Bevin in Lexington, Ky., on the night before the election.

“If you lose, it sends a really bad message,” Trump told supporters at the rally Monday. “If you lose, they’re going to say, ‘Trump suffered the greatest defeat in the history of the world. This was the greatest.’ You can’t let that happen to me.”

In a statement released Tuesday night, Trump’s 2020 campaign manager Brad Parscale said that, “The President just about dragged Gov. Matt Bevin across the finish line, helping him run stronger than expected in what turned into a very close race.”

Though some have argued Bevin’s unpopularity rendered his loss an outlier (Republican Tate Reeves won the Governor’s race in Mississippi; a run-off will take place in Louisiana between incumbent Democratic Gov. John Bel Edwards and his GOP challenger Eddie Rispone), both Beshear’s narrow victory, in a state Trump won by 30 points in 2016, and the Democratic takeover of Virginia’s state legislature, have signaled potential trouble for Trump’s path to reelection in 2020.

Get our Politics Newsletter. The headlines out of Washington never seem to slow. Subscribe to The D.C. Brief to make sense of what matters most. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Write to Katie Reilly at Katie.Reilly@time.com.