Republican Kentucky Gov. Matt Bevin’s refusal to concede Tuesday’s razor-thin gubernatorial election to Democratic challenger Andy Beshear could result in a weekslong process ultimately decided by the Republican-controlled state legislature and a bitter partisan political fight.

Beshear, currently Kentucky’s attorney general, received nearly 5,200 more votes than Bevin Tuesday, amounting to a 0.36% lead.

Bevin asserted that he would not concede to Beshear in part because of “irregularities” in the election, but he did not mention what those were. “We want the process to be followed, and there is a process,” he said.

The first step in challenging the election results would be a recanvassing, in which county election boards recheck vote machines and re-report vote totals to ensure that ballots and totals were added correctly. Bevin called for a recanvassing on Wednesday, and it will be conducted on Nov. 14.

Recanvassing is unlikely to significantly change the results. A recanvassing process challenging Bevin’s 83-vote lead in his 2015 primary election did not change any votes.

The next step in most election challenges in Kentucky would be a recount overseen by a judge, but that process appears to not apply to gubernatorial and lieutenant governor races.

Instead, the second step for a contested election for governor outlined in Kentucky statutes is the creation of a randomly selected board of three state senators and eight state House representatives to create an 11-person board. The board reports its findings in a joint session of the General Assembly, which then decides the results of the contested election.

Kentucky Senate President Robert Stivers, a Republican, said Bevin’s refusal to concede was “appropriate” and mentioned a deciding legislative process Tuesday night. He added that he thinks those who voted for Libertarian John Hicks — who received about 2% of the vote with 28,425 votes — would have voted for Bevin had Hicks not been on the ballot.

The legislative process for a contested gubernatorial election is largely uncharted territory.

A race for Kentucky governor has not been contested since 1899 when Democratic challenger William Gobel, then president pro tempore of the Kentucky Senate, was declared victorious over incumbent Republican William Taylor by an election board made up of hand-picked Gobel Democrats despite receiving 2,383 fewer votes than Taylor. Violent conflict ensued, and Gobel was assassinated and died four days after taking office.

While not at all likely to be as dramatic as the 1899 contest, a 2019 legislative process could be “in many ways as political as it is legal,” Joshua A. Douglas, election law and voting rights professor at the Kentucky College of Law, told the Washington Examiner.

“It doesn't appear to my reading in the statutes that there are certain requirements in terms of what the legislature would do,” Douglas said. “I think the three options would be, declare the party that's been certified as the actual winner, declare the challenging party the winner, or declare that they can't decide, and they call for a new election.”

Republicans have majorities of 59-39 in the Kentucky House and 39-9 in the state Senate, setting the stage for a potentially partisan process that upends Beshear’s slim lead.

The key determining factor will be what “irregularities” Bevin brings forward for the legislature to assess.

“First, we have to figure out if there's actually any evidence of any problems,” Douglas said. “I have no idea what he's talking about. It was pretty darn quiet from my perspective in terms of the process itself.”

Bevin has 30 days after the last action from the State Board of Elections to file notice that he is contesting the results and on what grounds, sending the process to the General Assembly.

“If there's no evidence and he's still trying to contest it, then it looks like a partisan power grab, and I'm not sure how many Republican legislators would go along with that,” Douglas said.

[ Opinion: Matt Bevin must concede defeat in Kentucky before he becomes the next Stacey Abrams]