HARRINGTON, Del. — Thousands of Toby Keith fans walked into the grand pavilion at the Delaware State Fair, looking for someone to take their tickets. Tom Carper was happy to help.

“I work here at the fair,” joked Carper, a three-term Democratic senator, introducing himself to concertgoers. He addressed the women in cowboy hats as “cowgirls.” He tipped his Navy cap to the men in military T-shirts. He joked around with the burly, tattooed biker: “Hey, didn’t I pardon you when I was governor?”

Carper, 71, has run and won statewide elections in Delaware since 1976. Until now, seeking his fourth term in the U.S. Senate, he had never faced a Democratic primary challenge — and never been accused of being out of step with a party that he had a large role in building.

This year, Carper is the No. 1 target of the people who helped Alexandria Ocasio-Cortez oust the fourth-ranking Democrat in the House, with one of her top staffers relocating to Delaware to help challenger Kerri Evelyn Harris in the Sept. 6 primary. He’s being watched closely by Republicans, who are running as Trump-style outsiders and who wonder whether a Democrat who once ran as “a senator for our future” may stumble or show his age.

The senator, who says that a fourth term would probably be his last, argues that none of his opponents understand what Delaware wants — and none can seriously accuse a former governor, congressman and state treasurer of failing to deliver for his state.

“The core of the Democratic Party in Delaware could be defined by [a verse in] Matthew 25: ‘I was naked and you clothed me, I was a stranger and you welcomed me,’ ” Carper said in an interview. “We have a moral imperative to help the least in our society. But because we don’t have unlimited resources, unlimited money, we have a fiscal imperative to do that in a responsible way.”

Delaware, with fewer than 1 million citizens and just three counties, is so small that candidates can credibly meet every voter in a party primary. In recent years, it’s become so reliably blue that Carper and Sen. Christopher A. Coons, his fellow Democrat, have come under fire not from Republicans but from liberal groups upset at their relative moderation. Both senators, for example, have opposed “Medicare for All” and voted to roll back parts of financial reforms put in place after the 2008 economic crash.

“Delaware needs a champion who will fight back, not a rubber stamp,” said Working Families Party chairman Dan Cantor, whose New York-based group is attacking Carper with digital ads.

Carper, a constant critic of President Trump who had been expected to cruise to a fourth term, has responded by beefing up staff and advertising. His Democratic friends are baffled that he’s being challenged at all. Carper’s opponents, they say, fundamentally misunderstand a state where 1 in 10 workers are employed by the financial industry and conservatives still control the balance of power in Dover.

“I think the success of Joe Biden led many people to think that this is a safe blue state,” said Coons, referring to the 36-year senator. “Democrats barely control the state legislature. Sussex County is deeply red. Kent County is purple. New Castle County is blue. You’ve got to show up to win, and Tom Carper shows up.”

Harris, a community organizer and veteran who is making her first run for any office, has struggled for funds and attention. As of July 1, Carper had raised $3 million for his reelection; Harris had raised just $46,650. In most years, the financial gap alone would have been enough for Democrats to write off the primary threat.

The victory of Ocasio-Cortez, who also was outgunned financially, changed that thinking. Harris and her campaign staff drove three hours to New York to help the challenger’s final push; a photo of the two women together now hangs in Harris’s downtown Wilmington campaign office.

“He’s hiring a field team, which he hasn’t had to do in years,” Harris said. “His policies are starting to align more with what we’ve been needing from the beginning. Universal health care, raising the minimum wage — his responses to that are different than they were before he had a primary opponent. I think it’s time for someone to notice the need before it becomes popular.”

Ocasio-Cortez has sent scores of donors and volunteers to help Harris, whose imperative is not only attracting Democrats but also adding new voters to the rolls. During a Friday night canvass in Wilmington, Harris spent 30 minutes talking to two men who had been passing a joint between them and were intrigued by her support for legal marijuana. By the end of the talk, one had agreed to come to her office to learn about volunteering.

“A lot of the same techniques we used in New York, we’re using here,” said Alexandra Rojas, who ran the New Yorker’s get-out-the-vote operation. “People of color make up around 30 to 40 percent of Delaware, but they haven’t been activated. There are places that have been totally left behind.” The general election would fall in place: “There literally aren’t enough Republicans here to surge against the Democrat.”

At the moment, national Democrats are deeply skeptical that Harris could beat Carper.

Carper has neutralized one of Ocasio-Cortez’s best issues — the idea that Rep. Joseph Crowley (D-N.Y.) had become physically out of touch with the people he represented. Carper, by contrast, is home so often that even Harris has seen him out on jogs.

Two elections, 10 years apart, weigh on the minds of Carper’s opponents. The first was his 2000 Senate run, in which he challenged five-term Republican incumbent William V. Roth Jr. The 79-year-old senator meandered in debates and took an on-camera tumble at one campaign stop. Carper, coming off two popular terms as a boom-time governor, was outspent by $2 million and won by 12 points.

“Some people in Delaware feel that Carper’s time is up because he appears to be following in the footsteps of Bill Roth,” said Mike Harrington, the chairman of Delaware’s Republican Party. “And you know what took down Bill Roth.”

The other source of deja vu was the 2010 election that brought Coons to the Senate. Republicans drafted then-Rep. Michael N. Castle, a former governor who supported abortion rights and clashed with tea party activists, to seek the open seat. His party’s voters rebelled, handing the GOP nomination to Christine O’Donnell, a far-right activist who went on to lose resoundingly to Coons.

“The people who failed to show up and vote for Mike Castle were the longtime, politically aware, politically engaged Republicans who did not believe for a second that someone like Christine O’Donnell could beat him,” Coons said. “The people in my party who might think, ‘Hey, Tom Carper can’t lose’ — they remember what happened to Mike Castle.”

In an interview, as he walked around a natural preserve for which he’d secured funding as governor, Carper said that he had talked to Castle about the defeat, and that his Republican friend advised him to take the primary seriously, riding the Amtrak back from D.C. every night he could and hitting the trail.

“God bless him, but I’m not Bill Roth,” Carper said. “When I was in the Navy, before they put us in airplanes, they put us through rigorous physical conditioning. I said, ‘I’m going to stay on this edge for as long as I can.’ I work out six days a week. Two days, I lift weights. Two days, I ride a bike. Two days I run — four miles on Thursdays, six to eight on Sundays. When I get up in the morning, I do 300 push-ups. I work 14-hour days. I haven’t taken a sick day in 35 years.”

Delaware Republicans, who have lost every Senate race in this century, insist that 2018 can be different — although that is predicated on being able to run against Harris, who favors a $15 minimum wage and universal health care, in a center-left state.

Republicans have also grown bolder about attacking Carper personally. In December, the Washington Free Beacon, a conservative news site and clearinghouse for opposition research, republished part of a 1998 interview in which Carper admitted to having “slapped” his first wife.

Carper had denied the attack when it was first used in his 1982 campaign for Congress — Republicans had gone overboard, accusing him of both spousal and child abuse — and after he won, Republicans never returned to the subject.

“It’s settled,” Carper said.

Last month, the incident made it into the Intercept, a left-wing news site that has aggressively covered Democratic primary challenges. While Harris said that she will not attack Carper personally, Republican candidate Rob Arlett, a Sussex County councilman, said that Carper’s personal life could be fair game.

“Look, I’ve been married to my wife for 29 years,” Arlett said in an interview. “I’m not someone who will hit my wife, or any woman.”

Arlett’s approach is rare in Delaware, where candidates celebrate the end of campaigns by literally burying a hatchet together in Sussex County. It also jars with both Harris, an affable campaigner who prefers to attack “the system” than her opponent, and with Carper, a fount of “dad jokes” who has met some voters multiple times.

At the Delaware State Fair, Carper bounded to the front of one parade, then another, stopping to catch up with a retired banker who had given him a loan during his first campaign. He noticed that John Taylor, 78, had some trouble walking to the Toby Keith concert, so he helped him locate an elevator.

“I shook your hand when you first ran,” Taylor said.

On the way back into the fair crowds, Carper was stopped, and stopped again, by constituents who recognized him — some from TV, some from a visit to their restaurant or school.

“There’ll be some day he has to retire,” said David Smith, 63, after shaking Carper’s hand. “But right now I want him to stay on and on and give it to Trump.”