Sen. Claire McCaskill is facing an extremely tough election in 2018.

The Missouri senator is considered the most embattled Democrat incumbent facing reelection in 2018; she’s near or at the top of nearly every list of toughest Senate races. A Democrat in an increasingly red state, McCaskill has survived the past two cycles in 2006 and 2012 with nothing short of political jiujitsu.

“It’s going to be a squeaker in my view,” said Adrianne Marsh, McCaskill’s campaign manager in 2012 and her communications director in 2006. “The dynamics, they’re tough.”

Missouri voted for Trump by nearly 20 points in 2016, and McCaskill needs to peel off some of those Trump voters to hang on to her Senate seat. Her challenger will likely be the state’s 38-year-old attorney general, Josh Hawley, the current frontrunner in the Republican primary on Tuesday. At the same time, McCaskill is struggling to hang on to her Democratic base, particularly black voters.

But for months, Hawley also had a problem: Missouri’s scandal-ridden former Republican Gov. Eric Greitens. Greitens was accused of coercing his hairdresser into nonconsensual sex acts and taking nude photos of her as blackmail, according to an explosive report from state lawmakers released in April.

Hawley and other Republicans wanted Greitens gone. For months, the governor refused to budge, insisting he had a consensual extramarital affair and calling the investigation and report into his conduct a “political witch hunt.” The state legislature considered whether to impeach him, and Hawley went public with evidence alleging Greitens may have committed a felony over the course of a separate investigation into a veterans charity the governor ran, unrelated to the sex scandal.

Greitens eventually resigned at the end of May. The disgraced former governor is no longer a drag on Hawley’s Senate campaign, but it’s still going to be tight.

It’ll be a tough — but not impossible — race for McCaskill. To say that Missouri is a solidly Republican state would be missing the point: It is a fiercely independent political landscape that McCaskill, a fiercely independent Democrat, has navigated skillfully for the past two decades.

Missouri state politics “is not about sheer partisanship; it’s about, do you make your case? Do they think you’re an honorable person?” longtime Missouri Democratic operative Roy Temple told me.

As McCaskill tries to court Trump voters and bring her base back into the fold, the 2018 midterms could be the toughest balancing act she has ever performed.

McCaskill is courting rural voters — and distancing herself from her party

McCaskill greets supporters during her 2012 Senate win.

Whitney Curtis/Getty Images

For years, McCaskill has embodied Missouri’s independent ethos. She’s “smack-dab in the middle” between a Democrat and Republican, according to Marsh.

Even so, McCaskill has mostly stuck with her party in Washington this year. She was part of a group of red-state Democrats who voted against the GOP’s massive tax cuts last year, upset with the lack of Republican outreach to conservative Democrats on the bill. McCaskill also voted against the repeal of Obamacare and has called for gun control measures to be implemented after the shooting in Parkland, Florida. (She has an F rating from the National Rifle Association.)

“What voters want is Claire McCaskill as a Republican,” Marsh said. “She’s not a Republican, but she operates above party politics.”

On the campaign trail, McCaskill has tailored her message to highlight her record of working with Republicans and to make sure Missouri voters don’t see her as too liberal, adopting some Trump-like language along the way. For instance, after violent clashes over Confederate statues in Charlottesville, Virginia, last summer, McCaskill told reporters she thought individual states and communities should decide whether to take down statues, saying they served a purpose — reminding Americans of the ugly past chapters of the country’s history, so that it was not repeated.

To win this year, McCaskill is trying to pick up moderates, spending lots of time courting Trump voters in rural areas. On the stump, she’s highlighting votes she cast in support of some GOP and Trump policies.

“My job isn’t to fight the president. My job is to fight for you,” she told voters last summer.

Last month, McCaskill made headlines for criticizing Hillary Clinton after the former presidential candidate said she won in parts of America that were “optimistic, diverse, dynamic, moving forward” — and implying the places she did not win were the opposite. McCaskill also said she sympathized with Missouri voters who cast ballots for Trump in an interview with MSNBC’s Kasie Hunt.

“For those of us that are in states that Trump won, we would really appreciate if she would be more careful and show respect to every American voter and not just the ones who voted for her,” McCaskill said.

As McCaskill spends time persuading white moderates to vote for her, there are signs of a possible left-wing revolt building, especially among Missouri’s urban African-American communities. The Black Lives Matter movement, which was born in Ferguson, Missouri, after the police shooting of Michael Brown, is experiencing a nationwide resurgence after recent police shootings of unarmed black men in Sacramento, California, and Brooklyn.

An empowered and energized progressive base is criticizing McCaskill for not showing up in the communities. McCaskill desperately needs black voters to turn out to win.

“If you’re going to win in Missouri as a Democrat, you’re going to have to get the black and the brown vote,” Rep. Emanuel Cleaver (D-MO) said, adding that he’s optimistic McCaskill can mend fences with the community. “I think she’ll rise to the occasion and do what needs to be done.”

McCaskill is worried about Trump voters. Her biggest challenge could come from the left.

Sen. McCaskill holds a press conference after addressing a forum of residents and community leaders after the shooting of 18-year-old Michael Brown in Ferguson, Missouri.

Scott Olson/Getty Images

A few months ago, the discontent some African-American voters have been feeling toward McCaskill bubbled over into public view at a town hall with state Rep. Bruce Franks Jr., a Democrat from St. Louis.

Franks has been calling for McCaskill to spend more time in Missouri’s black communities. Though he said he’ll vote for her in November, he issued a warning: “I’m going to vote for Claire, but Claire is going to have to bring her ass to St. Louis.”

This speaks to the left’s larger frustration with moderate Democrats who they feel don’t represent their best interest. That has some strategists worried that voters who don’t have a progressive Democrat to vote for may just not vote for Democrats at all, letting a Republican win.

Cleaver, a member of the Congressional Black Caucus on Capitol Hill and the former mayor of Kansas City, says he doesn’t think McCaskill will suffer irreparable damage from the frustrations of Franks and other activists, but he agreed she does need to do more in the state’s urban communities.

“Missouri is an interesting place; it’s really a place where you have to show me,” Cleaver said, nodding to the state’s nickname. “It’s the state motto, but politics is real. I think people want to see her.”

Cleaver, a vocal McCaskill supporter, believes that problem is easily fixable. But he and Marsh say this shift isn’t necessarily Missouri Democratic voters moving more to the left; rather, it’s that Missouri’s Democratic activists are more energized and emboldened in 2018 than they have been in years (along with the party’s base in much of the rest of the country).

“I wouldn’t say they’re moving left; I feel they’re more motivated,” Marsh told me. She also pushed back against the idea that McCaskill hasn’t shown up for African-American voters.

“No one in Missouri politics has fought harder for the African-American community than Claire McCaskill,” Marsh said, referencing the senator’s stance on criminal justice reform and mass incarceration, especially following Ferguson. “If you talk to the old guard, they’ll tell you the same. She’s always been a huge supporter and has stuck her neck out there at times when it’s been most difficult.”

McCaskill herself has promised black voters she’ll fight for them in Washington, and vowed to spend “millions and millions” of campaign dollars seeking their vote in November.

Did the Greitens scandal weigh down Josh Hawley’s candidacy?

Missouri Attorney General Josh Hawley.

John Sleezer/Kansas City Star/TNS via Getty Images

After two cycles of difficult defeats for Republicans against McCaskill, Josh Hawley was supposed to be the perfect candidate to do the job.

He’s the state’s young, conservative attorney general whom Republicans recruited to beat McCaskill in 2018. A graduate of Stanford and Yale Law School, Hawley has nevertheless cast himself in the mold of a Trump loyalist, railing against “political elites.”

The young AG is staunchly conservative and Christian. He has kept a fairly low political profile so far, although he got plenty of headlines for once claiming the sexual revolution of the 1960s and ’70s was directly responsible for human trafficking. (Hawley has said he thinks sex should be confined to marriage.)

“Our culture has completely lost its way,” he said in recent remarks to reporters. “The sexual revolution has led to exploitation of women on a scale that we would never have imagined.”

Democratic political operatives in Missouri are skeptical of Hawley’s alliance with Trump, saying it’s one of political convenience.

“The dude is a human pretzel right now, contorting himself,” said Temple. “The guy is trying to pretend he’s a populist, but he’s not very good at it. At the heart of it, he’s a phony.”

Polls show Hawley and McCaskill basically in a dead heat; the most recent RealClearPolitics average shows McCaskill up by a single point.

Hawley is sure to be breathing more freely with Greitens gone. The Greitens scandal dragged on for months, after details surfaced that Greitens allegedly coerced his victim into oral sex, took a nude photo of her as blackmail, and slapped her on multiple occasions.

“I think what was extraordinary about the report was everyone was prepared for it to be bad and uncomfortable and salacious,” said Missouri GOP consultant Gregg Keller in an interview this spring. “Even with the expectations set there, it still took a lot of people’s breath away.”

Hawley aggressively tried put distance between himself and Greitens. Earlier this year, the AG said his office discovered evidence that Greitens may have committed a felony-level criminal offense by using a donor list of his veterans charity — the Mission Continues — to ask for donations leading up to his 2016 campaign for governor.

Hawley was unusually blunt in remarks about an active investigation, calling Greitens’s conduct in the matter “serious misconduct” and adding he thinks it constitutes an “impeachable offense.”

Greitens refused to step down for months, and the governor’s lawyers called on Hawley to recuse himself from the investigation, saying that Hawley wasn’t conducting it impartially. All the while, it was a drag on Hawley’s campaign.

The governor’s conduct had a lot of people baffled, but not Missouri Republicans who knew him.

“He’s a classic sociopath,” said one Republican in the state who requested anonymity to speak freely about Greitens. “I’m not saying that ironically; he is literally not a balanced, normal personality. He’s almost incapable of embarrassment, like Bill Clinton was.”

The Greitens fallout was also a boon for McCaskill, who has benefited from Republican scandals in the past. In 2012, her campaign spent hundreds of thousands of dollars to try to get the ultraconservative Republican Todd Akin to win the Republican primary for Senate.

The reason? McCaskill was making a big bet that Akin would say something alarming during the general election. And that’s exactly what he did: Explaining his anti-abortion stance, Akin argued that instances of men raping women were rare, and during “legitimate rape, the female body has ways to try to shut that whole thing down.” McCaskill went on to win that race by 12 points.

Without the shadow of Greitens hanging over him, Hawley will be free to focus on attacking McCaskill from now until November. But she has demonstrated she can dish it right back.