EDITOR’S NOTE: This post was updated at 3:30 PM EDT to reflect the results of Tuesday's Democratic primary.

In the Hudson Valley, a distinctly Trump-like Democrat is facing an unexpected primary challenge in a key local race—one that’s mostly flown under the national radar.

At a candidates’ forum in Woodstock last week, Ulster County Sheriff Paul Van Blarcum, who is seeking his fourth term in office, raised eyebrows when he told the crowd, “It’s out there that I’m a racist, and that the sheriff’s office is racist. Am I getting sued by four black officers? Yes. But let me tell you this: They’re suing me for not getting promoted. Two out of the four never even took a promotional exam. The third one took the exam and failed. The fourth person took the exam, and passed, but unfortunately, he was arrested for stealing from the sheriff’s office. So that makes me a racist and I don’t understand it.”

He added: “As far as the other lawsuits against me, we’ve won every one of them.” (A female corrections officer who sued the Ulster County Sheriff’s Office in federal court for on-the-job harassment was awarded a large settlement in 2014.)

Norman James, who retired from the sheriff’s office in April after 30 years working at the Ulster County jail, is one of the plaintiffs in the case Van Blarcum mentioned in Woodstock (there are five in total, and two are no longer with the department). He said he and the others are suing the sheriff’s office in federal court for systemic discrimination against the department’s small number of black corrections officers.

“The white officers get a lot better treatment than the black officers do,” said James. “If you’re a black officer and you commit some sort of infraction, you’re dealt with much more harshly by the administration than if you’re white. If you’re white, you may get a 30-day suspension, but it’s easily forgiven and forgotten and you’re still able to advance. You also get easier job assignments.”

“There’s an old-boy network,” he said, “and it’s all white.”

Van Blarcum didn’t respond to an interview request.

James told me about a white officer who threw a glass at a woman in a bar, causing a facial injury that required 150 stitches. He faced a 30-day suspension and then went on with his career. The black cop who was “arrested for stealing from the sheriff’s office” was a veteran with a clean record who ran out of gas one night and filled up his personal vehicle with the department’s gas. He offered to pay restitution. According to James, that incident occurred 15 years ago, and that officer has been repeatedly passed over for promotions ever since. “Twenty-two years on the job, and he’s still working on the housing units like a rookie,” he said.

“I have no interest in promotions,” said Tyrone Brodhead, a 19-year veteran of the department and another plaintiff in the suit. “My issue is that I’m constantly being accused of bringing in contraband and subjected to internal affairs investigations. I’m subjected to locker searches, vehicle searches and personal searches. They’ve never substantiated any of these charges, but I’ve been labeled a drug dealer.”

“I’ve been on the countywide swat team, but I’ve been held back from operations whenever they involve narcotics,” Brodhead observed. “I’ve never been involved in drugs, I don’t use drugs, and there’s no reason for this other than the color of my skin. It’s a hostile work environment.”

The attorneys representing the officers didn’t respond to an interview request by press time.

In 2014, Van Blarcum ran unopposed for his third term in office. He was reelected easily, taking 90 percent of the vote. According to the Times Herald Record, Van Blarcum’s vote total in the county that year exceeded that of both the Democratic and Republican gubernatorial candidates combined.

But in May, as several other local incumbents sailed to easy victories at the Ulster County Democratic nominating convention, Van Blarcum faced an uprising among local Democratic officials and activists. He reportedly left the venue before his bid for the nomination was rejected by a lopsided, 85 percent to 15 percent margin.

What shifted in the intervening years? Andrew Zink, president of the Ulster County Young Democrats, said, “The election of Donald Trump changed the equation.” (Local Democrats were furious when Van Blarcum and several of his deputies appeared in a photo-op with the president in the Oval Office.) “Trump’s election woke people up,” said Zink. “Trump made us look at these local issues and evaluate our local elected officials and ask ourselves, ‘is this what we want?’ And when the Democratic voters of Ulster County looked at that question in that race, they said, ‘no, we don’t want our own Donald Trump.’”

Since his last, easy reelection in 2014, Van Blarcum has made a series of headlines, some going national, that alienated restive Democrats. Local activists said Van Blarcum’s tendency to use his office to amplify hard-right messages became intolerable after the 2016 election.

In the days following a 2015 mass shooting that left 14 people dead in San Bernardino, California, Van Blarcum urged county residents with gun permits to carry firearms at all times. The appeal was posted on his office’s official Facebook page. The following year, he trashed local “sanctuary city” ordinances, and said that his deputies, who, according to Van Blarcum, have long cooperated with the federal Immigration and Customs Enforcement agency, wouldn’t change the way they did business. Shortly before his last election, he’d angered gun safety advocates by urging his deputies to “use discretion” when considering charges against people who violated the Secure Ammunition and Firearms Enforcement (SAFE) Act, a gun-control package that New York state passed in the wake of the Sandy Hook massacre.

“The sheriff’s made it very clear that he’s above the law,” said Dan Torres, a New Paltz City Councilor and a fierce critic of Van Blarcum. “He’s done that by campaigning with county resources, thumbing his nose at communities that want to protect their immigrants, making wild statements about guns, and then getting the country sued multiple times because of his actions. He’s a wingnut with a real disregard for the US Constitution.”

Van Blarcum’s Democratic challenger, Juan Figueroa, said that it was the sheriff’s decision to weigh in—again, on the Ulster County Sheriff’s official Facebook page—on NFL players taking a knee to protest racially discriminatory policing that first drew his interest in the race. The post, which echoed tweets about the issue from Donald Trump, claimed that the players had “show[ed] an utter lack of patriotism and total disrespect for our veterans—living and dead—and everything that they put their lives on the line for!” It called for Ulster County residents to “boycott all football telecasts [and] refrain from attending or viewing any NFL games.… let the NFL play to empty stadiums.”

Figueroa, a New Yorker of Puerto Rican descent, said the post was part of a “pattern of that sort of behavior” that “just shows [that Van Blarcum] has been in office a little too long and doesn’t realize what his job is supposed to be. When you use your office for something like that, you’re abusing your office. The sheriff is elected by the people, and he’s supposed to represent all of the people.”

Figueroa was also incensed by Van Blarcum’s practice of conducting “suspicionless warrant checks” on people entering the local social-services office, a practice that was only discontinued after then–New York Attorney General Eric Schneiderman sent county officials a letter clarifying that the policy was discriminatory and “in violation of civil rights law.”

Figueroa, a stocky, 53-year-old retired state trooper and veteran of the first Gulf War, doesn’t fit neatly into the narrative of a leftist insurgency raging against a centrist Democratic establishment. Describing his politics as “middle of the road,” he said that his campaign, to some degree, has been driven by a broader “backlash” against Donald Trump’s presidency. “I’ve been involved in other races, but this is different,” said Figueroa. “I have never seen so many people get involved in local races.”

Figueroa faced some resistance from local Democratic officials when he first considered getting into the race. Some dismissed Van Blarcum’s bluster as just that, and felt that it was better to have an incumbent Democrat in the office than risk losing it to a Republican who might be more reactionary. And there was a sense that Van Blarcum was simply unbeatable.

Local activists also tell me that some were wary of opposing the sitting sheriff due to the very nature of his office. “The sheriff’s office is supposed to be there for all citizens of Ulster County,” said Zink. “But now, people [who don’t agree with Van Blarcum’s politics] think, ‘Well, if I have a bumper sticker and the sheriff’s office pulls me over, or I need help, are they going to support me?’”

But Dan Torres, who introduced Figueroa at the county nominating convention, said those worries were dispelled when Figueroa took the stage. “I’m not being overdramatic when I say it, but people cried when he spoke,” he said. “They saw a guy stand up there and talk about how his parents told him that being a person of color meant he had to work that much harder. And he talked about what it meant to be a person of color in law enforcement, and how that affected his views on policing and his views on what it means to be an American.”

Figueroa is not only Van Blarcum’s opposite in terms of their respective approaches to law enforcement. He also represents Ulster County’s increasingly diverse, younger, and more Democratic-leaning population. In some ways, the county is a microcosm of the country, with deep-blue towns dotting rural areas that went big for Donald Trump in 2016. Figueroa’s supporters are hoping that an energized Democratic coalition will deliver a rebuke not only to Donald Trump in November but also to their own Trump-like sheriff.

Because of New York State’s arcane fusion-voting system, Figueroa has to beat Van Blarcum three times to win the office. He won their first contest at the county nominating convention, and he trounced the Sheriff in the September 13 Democratic primary, winning 82 percent of the vote. But come November, Van Blarcum will still appear on the November ballot on the Republican, Independence Party, and Conservative Party lines.