Democratic presidential candidate Hillary Clinton takes a selfie with campaign supporters during a campaign stop in Louisville. (John Sommers II/Getty Images)

Hillary Clinton is putting up an unexpected fight in Kentucky, a state that her campaign had thought until quite recently might be out of reach in her primary race against Sen. Bernie Sanders of Vermont.

In advance of Tuesday’s Democratic primary, Sanders also campaigned heavily in Kentucky over the weekend, and Clinton planned two additional days there, a sign that she thinks she has a chance to stop Sanders from racking up an unbroken string of victories between now and the end of primary voting in June.

Oregon’s primary will also be held Tuesday, by mail-in ballot. Republicans held their primary in Kentucky in March. Republicans will vote in Oregon Tuesday, even though Donald Trump was declared the presumptive nominee after his victory in Indiana two weeks ago.

There is little recent public polling in Kentucky, but the Clinton campaign hopes to benefit from a different political environment than the one that greeted her in nearby West Virginia, a state she lost last week by 15 points.

For instance, Kentucky will hold a closed primary, shutting out independents who have heavily favored Sanders in other contests.

Democratic presidential candidate Hillary Clinton said she's "never heard such reckless, risky talk" about nuclear weapons from a future presidential nominee than from Donald Trump during a rally in Louisville, Ky. (Reuters)

The state’s moderate Democratic leanings also may favor Clinton. She has consistently performed well among Democrats — even in West Virginia, where she lost overall to Sanders but won 49 percent to 45 percent among those registered as Democrats.

“She’s a little more conservative,” Sherry Baucom, 47, of Louisville said, then paused to correct herself. “Not conservative — a little less liberal than Bernie.”

She added, “That’s how she’s going to win the state.”

Kentucky Democrats are still reeling from conservative Republican Matt Bevin’s victory in the governor’s race last year. Bevin succeeded Democrat Steve Beshear, who was prohibited by term limits from seeking a third term.

Beshear’s legacy — especially his efforts to implement the Affordable Care Act in a Southern state — is closely tied to the pitch Clinton has made to voters: that she would continue President Obama’s policies.

“The thing I’m most proud of is right now in our state, for the first time in history, every single Kentuckian has access to affordable health care — the only Southern state to do it,” Beshear said at a campaign event Sunday in Fort Mitchell. “But we did it right. We’re the model for the nation, and by golly, we’re not going to let it go away, either.

“Folks, those are the priories of Hillary Clinton,” he added.

Campaigning over the weekend, Sanders made a point of distancing his vision of implementing a “single-payer for all” system from Bevin’s efforts to undermine Obama’s health-care law.

“Let me begin by making a very short statement so the people of Kentucky will understand what kind of president I will be. And that is I understand your new governor, Governor Bevin, is busy cutting health care and cutting education,” Sanders said Saturday in Bowling Green. “So if you can imagine the kind of governor Governor Bevin is, think about Bernie Sanders as a president doing exactly the opposite.”

Sanders drew thousands from across the state to his weekend rallies in Paducah and Bowling Green, while Clinton drew several hundred to events in Louisville and Fort Mitchell.

Despite Clinton’s efforts, upcoming primaries are likely to reinforce the continued support her rival has among Democrats across the country.

Over the weekend, for example, Sanders supporters in Nevada put up a fight to win a small delegate edge at the chaotic state convention, perhaps foreshadowing a similar battle at the Democratic National Convention in Philadelphia in July.

Clinton also faces significant challenges here. She is still answering for a gaffe she made in March, when she said that her renewable energy plan would put the coal industry “out of business.” West Virginia voters got an apology from Clinton ahead of their primary, and she has said the remark was taken out of context. But the effects of that comment still sting in Kentucky, where mining is a smaller but still important industry in parts of the state.

“I think she got hurt by the comments about coal,” said Stephanie Lewis, 40, of Louisville, who supports Clinton. “I’m originally from Eastern Kentucky, and when I was back home for Mother’s Day, I heard about it a lot. . . . That’s kind of Bernie country.”

Clinton and Sanders have virtually the same position on ­clean-energy jobs, but her articulation of the position has hurt her in coal-producing states.

Sanders is expected to find support among those voters who are still smarting from job losses.

“He stated it differently,” said Bill Garmer, a former chairman of the Kentucky Democratic Party, explaining why Sanders has not been hurt by his position on coal. “He stated that he’s concerned, that he recognizes that coal jobs are being lost.”

Last week, former president Bill Clinton traveled to Eastern Kentucky to campaign for his wife and to do some damage control. The visit drew protesters, but Clinton sought to remind them of his wife’s commitment to $30 billion in aid for coal country.

“I’m the only candidate who has put on the table a plan for coal country,” Hillary Clinton said Sunday in Louisville. “Because I don’t think we should leave behind the people who turn on the lights and power the factories in the United States.”

It is unclear whether that effort will pay off, but Sanders is expected to benefit from Clinton’s troubles.

“People see it as a cultural attack,” said Dale Emmons, a longtime Democratic political consultant in Kentucky. “I think the fact that Hillary Clinton is seen as the inevitable Democratic nominee, there will be some who will cast votes for Senator Sanders in protest of Secretary Clinton’s position.”

There are several reasons the Clinton campaign has begun to feel optimistic that it can close the gap.

The campaign’s last-minute work in the state featured signs of her typical outreach to her most faithful voters — starting with the state’s relatively small but reliable African American voting population.

At two church services Sunday morning, Clinton was introduced to predominantly African American congregations as the “next president” of the United States.

African Americans make up more than 20 percent of the population in vote-rich cities such as Louisville, in Jefferson County. Unlike eight years ago, when Clinton lost the county to Barack Obama, she could show unexpected strength against Sanders in one of the state’s liberal enclaves.

The campaign also dispatched Rep. Hakeem Jeffries (D-N.Y.) to turn out African American voters on Clinton’s behalf.

Some pro-Donald Trump Democrats are likely to be in Kentucky, as there were in West Virginia, and those voters may support Sanders.

But Emmons, the Kentucky political strategist, said that what is likely to be the most unpredictable factor in this primary is turnout, which is expected to be “modest at best.”

“I really do believe that this campaign has been so long that many people are weary of the presidential campaign because it has been front and center. . . . People are just worn out with it,” Emmons said.

Emmons said Sanders still has the upper hand in Kentucky, but he noted, “Low-turnout elections will often hand you surprises.”