HUNTERSVILLE, N.C. — On Thursday night, Sen. Thom Tillis (R) and Democratic challenger Cal Cunningham bumped elbows at their final debate in the contentious North Carolina race that could determine which party controls the Senate.

Not 24 hours later, both candidates’ lives — and possibly the fate of the upper chamber — were upended, as Tillis tested positive for the novel coronavirus and Cunningham acknowledged sending illicit texts to a woman who is not his wife.

Now, both men are in their homes, one self-isolating and the other dodging reporters asking about those texts, including messages that emerged late Tuesday suggesting an intimate encounter. And in Washington, both parties are seeking to capitalize on the 11th-hour drama to boost their candidate’s political fortunes.

Republicans are perhaps the most optimistic. After privately fretting about Tillis’s standing for weeks, the GOP sees a potential game-changer in the revelations about Cunningham, a married father of two who has argued about the importance of character.

Tillis, calling into Fox News on Tuesday morning, demanded a full explanation from Cunningham. The Senate Leadership Fund, a super PAC aligned with Majority Leader Mitch McConnell (R-Ky.), began airing an ad criticizing Cunningham for infidelity.

“Politician Cal Cunningham hid the extramarital affair for months, but Cunningham got caught,” the new ad says. “What else is he hiding?”

Yet Democrats in North Carolina and Washington remain steadfastly behind their embattled Senate candidate. They say Tillis’s covid-19 diagnosis — following his appearance at a crowded White House event with no social distancing and few masks — is the perfect example of the GOP’s bungled pandemic response.

Tillis attended the Sept. 26 Rose Garden event where President Trump announced his nomination of Judge Amy Coney Barrett to the Supreme Court. He was wearing a mask outdoors but was later photographed without one inside the White House with the president, who also has contracted the disease.

Tillis repeatedly talked about the importance of wearing a facial covering and even apologized weeks ago for failing to wear a mask at another White House event.

“This race is about which candidate will stand up for North Carolina and protect our health care,” Wayne Goodwin, chairman of the state’s Democratic Party, said in a statement. “The fact is that there’s only one candidate who has blocked Medicaid expansion, voted to end protections for people with preexisting conditions, and enabled this administration’s bungled response to this pandemic, which is why North Carolina will send Cal to the U.S. Senate next month.”

On Tuesday evening, the Associated Press published more texts suggesting Cunningham and a woman in California engaged in an extramarital relationship, with one encounter as recently as July. In one text, the woman who confirmed the affair to the AP told her friend she was intimate with Cunningham at his house, where his family lived.

Still, Democrats and Republicans agreed that there is no way to replace Cunningham on the ballot — more than 386,000 North Carolinians returned absentee ballots by early Tuesday. And Democrats say they would not do that anyway.

Gov. Roy Cooper (D), who is on the ballot this fall, was asked at his weekly news briefing whether he still supported Cunningham and said: “Yes, I do.”

The dramatic turn of events comes just four weeks from Election Day, and Tillis and Cunningham have been neck and neck in the polls. The race — which both sides agree will probably determine the Senate majority — was basically tied at the beginning of September. More recent surveys, however, have showed Cunningham with a small lead, averaging about five points, according to a Washington Post analysis of polls there last month.

Additionally, Cunningham last week announced an impressive third-quarter fundraising haul, $28 million in three months — more than double the amount the GOP incumbent raised in the previous half-decade. Democrats are confident they can use that cash to fight the GOP’s bid to attack him for infidelity.

Yet both of those advantages came before news broke that Cunningham told the wife of a veteran he served with that it “would make my day to roll over and kiss you about now.”

He issued a statement late Friday night, saying he had “hurt my family, disappointed my friends, and am deeply sorry,” adding that he took complete responsibility and asked for privacy.

He canceled a scheduled virtual town hall on Monday.

It’s unclear how much the dramatic turn will affect the race. Democrats privately predict voters will forgive Cunningham’s transgressions, arguing that the GOP’s mishandling of the pandemic is far more important. And the two candidates have finished their three debates, giving them little public face time to quarrel over the issue.

Indeed, interviews on Tuesday with eight voters in the Charlotte suburb of Huntersville, Tillis’s hometown, found most voters standing by choices they had made before last week’s revelations. Sharyn Brunk, a 72-year-old retired software company founder, said she had planned to vote a straight Republican ticket, and that hasn’t changed. She said she barely followed Tillis’s covid-19 diagnosis and likes the job Trump has done on the economy.

Likewise, Arnold Fox, a 68-year-old salesman who is unaffiliated but often votes Democratic, said he will stick with his vote for Cunningham — even as he finds his infidelity “very disappointing.”

“I’m definitely against Trump and anybody who supports him,” he said.

Republicans have sought to latch on to the Cunningham revelations as quickly as they can. Tillis did his Fox News interview from home, saying he was feeling good despite his diagnosis — and hitting Cunningham on the latest news.

“Cal owes the people of North Carolina a full explanation,” Tillis said Tuesday morning. “At the debate stage last week, Cal said it’s about integrity, and I agree.”

It’s unclear, however, whether the attack will work.

North Carolina, once considered solidly red, is changing and has grown deeply polarized. In Mecklenburg and Wake counties, the suburbs that ring Charlotte and Raleigh, respectively, there are 143,000 more registered voters than there were four years ago, with a strong tilt toward younger and minority groups that favor Democrats.

There are also few undecided voters left in any of the three marquee races here, and liberal partisans have spent tens of millions of dollars on the race because of its implications — flipping the majority in the Senate, a goal that remains despite Cunningham’s actions.

The race could now turn on a morality test in the era of Trump and #MeToo. Democrats are betting that a consensual relationship, outside of marriage, will not be judged as harshly as the outright sexual assault talk that Trump bragged about when he was a reality TV star.

On Tuesday, two likely voters, siblings Mellion and Cherri Armstrong, considered the dilemmas the race posed. They said they planned to vote against Trump, but they hadn’t heard about either Senate candidate’s recent troubles and hadn’t decided on their choice in that race.

After being apprised of the developments, Cherri Armstrong, a 20-year-old registered Democrat who works at an Amazon warehouse, didn’t like what she was hearing about either man. She was bothered that Cunningham had been disloyal to his wife but also said Tillis “made a very dumb decision not to wear his mask.”

Her brother Mellion, who is 21 and unaffiliated, sounded more decisive. He won’t vote for “the dude with the covid-19,” he said. “I would have to go with the guy with the affair.”

Bade and Kane reported from Washington. Amy Gardner contributed to this report.