Louisville, Ky. — Kentucky Gov. Matt Bevin cleared his first hurdle toward a second term, defeating three Republican challengers Tuesday. His arch-nemesis, state Attorney General Andy Beshear, won the Democratic primary, setting up a public battle over education and pensions.

Beshear, the state's attorney general, defeated two prominent rivals - Rocky Adkins and Adam Edelen - in the Democratic primary. He'll try to restore the governorship for Democrats and carry on a family tradition. His father, Steve, was a popular governor whose two terms preceded Bevin's tenure.

Now he's on to the main event to be settled in November - Bevin vs. Beshear.

Get Breaking News Delivered to Your Inbox

While Bevin claimed the nomination in GOP-leaning Kentucky, an upstart challenger — state Rep. Robert Goforth — attracted a sizable share of the vote in a sign the incumbent has fence mending to do with his political base. Bevin got a last-minute boost from President Trump.

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! #MAGA — Donald J. Trump (@realDonaldTrump) May 21, 2019

Mr. Trump waded into the Kentucky GOP primary by tweeting his support for Bevin and recording a phone message urging GOP voters to back the governor. Bevin shares a style similar to Mr. Trump's. The Republican businessmen are proudly unconventional conservatives who favor social media and attack critics fiercely.

But his most prominent Republican challenger showed strength with the GOP base. Goforth put at least $750,000 of his own money into his insurgent campaign, which attacked Bevin for his combative style and his struggles on the pension issue. CBS Louisville reports Goforth earned 40% of the vote.

Despite the early strong showing by his main challenger, Bevin will have the advantage in the fall campaign of heading the Republican ticket in a state that has trended overwhelmingly toward the GOP in recent years.

Bevin claimed the GOP nomination despite a series of self-inflicted political wounds from his feud with groups representing school teachers. Bevin's approval ratings slumped after his failed attempt to change the state's struggling public pension systems.

In a pre-emptive shot, the Democratic Governors Association said even Bevin's allies at the White House are worried about his reelection.

"They have every right to be worried — the bluegrass state is ready to turn the page from the failed Bevin era," the group said in a statement.

During the primary campaign, Bevin was a prime target for the Democrats looking to oust him. Goforth also ran an aggressive campaign, trying to capitalize on the governor's public spats with teachers.

Bevin has sharply criticized teachers who used sick days to rally at Kentucky's Capitol, forcing some school districts to close.

In 2018, he asserted without evidence that a child who had been left home alone was sexually assaulted on a day of mass school closings as Kentucky teachers rallied. He apologized but then doubled down last month, connecting a young girl's shooting in Louisville with school closings caused by more teacher protests.

Kentucky teachers rallied last year to oppose pension changes and to demand more funding for schools. Protests continued this year against some education measures. The demonstrations were part of a nationwide wave of teacher activism.

Bevin has steered Kentucky on a conservative course along with the state's GOP-dominated legislature. He supports school choice efforts and signed measures to restrict abortion, allow people to carry a concealed handgun without a permit or training and a right-to-work measure letting workers evade union fees. Several of the abortion measures are being challenged in court.

He's also tried to revamp the state's Medicaid program to require "able-bodied" adults to get a job, go to school or volunteer as a condition to continue receiving the benefits. A federal judge blocked the rules and Bevin's administration appealed.