Sen. Heidi Heitkamp, the most endangered Senate Democrat in next month’s midterm elections, apologized Tuesday for a newspaper ad that included names of victims of domestic violence, sexual assault or rape without their permission.

The ad was fashioned as an open letter to Rep. Kevin Cramer, Heitkamp’s Republican opponent, criticizing comments he made during the confirmation process for Supreme Court Justice Brett M. Kavanaugh.

In a statement Tuesday, Heitkamp (N.D.) said that her campaign “recently discovered that several of the women’s names who were provided to us did not authorize their names to be shared or were not survivors of abuse.”

“I deeply regret this mistake and we are in the process of issuing a retraction, personally apologizing to each of the people impacted by this and taking the necessary steps to ensure this never happens again,” the statement said.

Republicans are defending a 51-to-49 Senate majority and North Dakota represents their best chance to flip a seat from blue to red. Polls have shown Cramer leading Heitkamp, and President Trump won the state by 36 percentage points in 2016, giving the incumbent no margin for error as she tries to defy the odds in the final stretch before the Nov. 6 election.

The ad included names of 127 women. It was not clear how many names were erroneously included or how they came to be part of the newspaper ad.

After publication of the ad, several women whose names were included spoke out on social media.

Lexi Zhorela of Bismarck wrote on Facebook that she was “beyond FURIOUS.” She said many women on the list, including her, “didn’t want our name spread across the news for everyone to see” and risked retribution from a prior rapist or boyfriend who beat them.

Kady Miller, also of Bismarck, wrote on Facebook: “A lot of these people listed, including me, did not give anyone permission for our names to be posted. I don’t even support Heidi Heitkamp and I am not a domestic abuse survivor. Should this even be legal?? Using people’s names as part of your campaign??”

The Heitkamp ad came in response to Cramer’s characterization of the #MeToo movement as a “movement toward victimization.” He spoke against the backdrop of the controversy over the nomination of Kavanaugh, who faced allegations of sexual misconduct decades ago that he vigorously denied.

While Heitkamp voted against Kavanaugh’s confirmation, Cramer supported it.

“We are here to let you know that you are wrong — this is not ‘a movement toward victimization,’ it’s about being a survivor,” said the open letter in the ad.

Heitkamp faced swift criticism from Republicans. The senator’s “campaign will be over in a few weeks,” tweeted Republican National Committee Chairwoman Ronna McDaniel. “But this act of political desperation will likely follow these women for years to come.”

Cramer told the Associated Press that he considered the mistakes in Heitkamp’s ad “a revictimization of victims.”

“This is what happens when desperate people do things for their own personal political gain,” he said. “She proved a point that her personal politics matter more than someone’s personal pain.”

Heitkamp announced her opposition to Kavanaugh two days before he was confirmed by the Senate. In a lengthy statement announcing her decision, Heitkamp said her “lifetime of work, advocacy, and commitment to these issues, and to these women and girls, helped inform my decision.”

After Cramer questioned in September whether an accusation against Kavanaugh should disqualify him from the high court, even if it is true, Heitkamp’s campaign criticized him.

On Tuesday, it was Heitkamp who was dealing with criticism. In an interview about her ad with North Dakota conservative radio host Rob Port, Heitkamp said her campaign had started hearing from victims of sexual assault who wanted to respond to Cramer’s comments about victimization, but that “unfortunately, the execution here was horrible.”

Asked by Port how the names ended up in the ad, Heitkamp said, “We’re trying to track that down.”