Kentucky Gov. Matt Bevin (R) took just over half the vote to win the Republican nomination for his current job, in spite of an Election Day endorsement fromand early spending from national Republican groups on his behalf.

With more than two-thirds of precincts reporting, Bevin led state Rep. Robert Goforth (R) by a margin of 51 percent to 40 percent. Two other candidates split almost 9 percent of the vote.

The result is an embarrassment for Bevin, one of the least popular governors in America. Several Kentucky Republican strategists told The Hill on Tuesday they expected Bevin to claim between 60 and 80 percent of the vote in the Republican primary. He fell well short of those expectations.

During his first term in office, Bevin has shown repeatedly he is no career politician. He picked fights with teachers unions, suggesting that several children had died because teachers went on strike demanding better pay, and he battled with members of his own party over the commonwealth's mounting pension crisis.

In recent weeks, he has been booed at town hall-style meetings, even in conservative corners of the state, including at this year's Kentucky Derby.

In a deeply Republican state that gave President Trump 62.5 percent of the vote in 2016, Bevin took just 53 percent of the vote in 2015 to win his job. Goforth spent more than $750,000 of his own money to claim Bevin could not win reelection.

The Republican Governors Association ran ads boosting Bevin during the primary, an unusual step for a group that ordinarily saves its money for beating up on Democrats in the sprint to a general election.

Trump, who remains popular in Kentucky, added his own endorsement via Twitter on Tuesday.

"To the great people of Kentucky, please go out and vote for Matt Bevin today. Very important. He has done a fantastic job for you and America!" the president wrote

Bevin posted a selfie of dinner with friends and family in the governor's mansion just after polls closed. He spent the final day of the primary election holding a town hall, rather than actively campaigning. Bevin planned to hold a press conference on the steps of the governor's mansion later tonight.

Bevin will face his chief antagonist, Attorney General Andy Beshear (D), in November. Beshear, the son of former Kentucky Gov. Steve Beshear, has sued Bevin's administration on a seemingly regular basis over pension reforms, education boards and, most recently, teacher sickouts.

With 93 percent of precincts reporting, Beshear held a lead of 38 percent to 32 percent over Rocky Adkins, the state House minority leader. Adam Edelen, a former state auditor who outspent both his Democratic rivals, trailed with 27.5 percent of the vote.

Kentucky is a deeply conservative state but one in which the rural migration from the Democratic to Republican Party has been slow. The state has no problem electing governors of both parties — the last four governors have alternated between Democrats and Republicans.

There are still 240,000 more registered Democrats in the state than registered Republicans, even though many of those Democrats reliably vote Republican. Several state legislative districts in eastern Kentucky, in the heart of coal country, are 80 percent Democratic or more but gave Trump 80 percent of the vote or more.

Several Republican strategists said Bevin's path to victory would be to nationalize a statewide race by bringing in Trump and painting Beshear as a typical liberal Democrat.

"It will be competitive, but Bevin has the wind at his back — he has the benefit of a good political environment, a popular president and the ability to draw a clear contrast with a far more liberal opponent," said Phil Cox, a former executive director of the Republican Governors Association.

"The contrast in this election could not be more clear. The leadership of President Trump and Governor Bevin has grown the economy resulting in over 50,000 jobs leading to the lowest unemployment in Kentucky history," Davis Paine, Bevin's campaign manager, said in an email. "Andy Beshear brags about voting for Hillary Clinton and will oppose the President at every opportunity."

Democrats said they were banking on Kentucky voters opting for a change rather than four more years of political rancor.

"After barely eking it out of his own party's primary as a sitting incumbent, Matt Bevin enters the general election damaged and deeply unpopular," said Noam Lee, the executive director of the Democratic Governors Association. "His gross mismanagement at the expense of everyday Kentuckians is near its expiration date."

Kentucky is one of three states — along with Mississippi and Louisiana — where voters will elect a governor this year.