Hillary Clinton has wrestled with allegations surrounding her husband's infidelities for much of their 40-year marriage, including a sexual harassment lawsuit, a grand jury investigation and an impeachment vote centered on his untruthfulness about a relationship with a White House intern.

Now, her Republican opponent Donald Trump and his surrogates have signaled that he may bring up the subject in the next presidential debate, treacherous territory, given his own infidelities and treatment of women.

Clinton's friends say they have seen her deal with Bill Clinton's conduct before, bristling at threats and countering them with steely determination. Her reaction, said longtime Arkansas friend Jim Blair, is to face accusers and respond thus: "These people are not going to run over us."

Her detractors, though, say that Clinton has unfairly lashed out over the years at the women involved in her husband's indiscretions. Her responses have forced her to walk a fine line during the campaign on sexual assault issues, even as she builds strong political support among female voters.

Trump and his backers have kept the subject alive with taunting social-media messages, and this week, Trump congratulated himself for taking the high road Monday in the first debate by not saying something "extremely rough" about the Clinton family. He added that he might not show the same restraint at the next public forum on Oct. 9.

Eric Trump said Tuesday that his father had displayed "courage" by not waging the attack, even as Trump's surrogates began to do so on national television. Clinton's allies say she is well-equipped to fend off the attacks.

Clinton's Little Rock pastor, the Rev. Ed Matthews, recalled a conversation with her in 1992 after he noticed explicit drawings of Bill Clinton in the parking lot just outside the church that Hillary and Chelsea Clinton attended.

The pastor said he asked her in a phone call how she was dealing with it.

She responded bluntly, the Methodist minister said in an interview, telling him that her family had dealt with such rumors for years and would get through it.

The Trump campaign has argued that the issue facing Hillary Clinton as a candidate is not the behavior of her husband but the role she played in shaping responses to accusers. She discredited claims later revealed to be true and worked behind the scenes to help manage the allegations, according to former aides.

In November, the issue surfaced again after the Democratic candidate sent out a tweet saying that assault victims deserve to be believed. At a public forum in December, a questioner confronted Clinton and asked whether her comment also applied to her husband's accusers.

"I would say that everybody should be believed at first," she said, "until they are disbelieved based on evidence."

On Wednesday, Clinton campaign spokesman Brian Fallon said in a statement: "After his disastrous debate performance and his sexist attack on a former Miss Universe over her weight, Donald Trump is now trying to deflect by going after Hillary Clinton about her marriage.

"While Trump and lieutenants like Roger Stone and David Bossie may want to dredge up failed attacks from the 1990s, as many Republicans have warned, this is a mistake that is going to backfire. He can try to distract from his demeaning comments against women, but if Donald Trump thinks these attacks against Hillary Clinton are going to throw her off her game and what matters to move this country forward, he is wrong."

`She knew he liked attention'

Hillary Rodham moved to Arkansas in 1974, and Blair said rumors of Bill's womanizing were not a deal-breaker for Hillary before she agreed to marry him in 1975.

"She knew he liked attention, and he liked attention from anyone," Blair said. "From the barber, the shoeshine boy, the homeless man. It didn't matter."

Bill Clinton was elected governor of Arkansas in 1978 and served as attitudes were shifting about the relevance of politicians' sex lives. Presidential candidate Gary Hart's overnight cruise with a young woman doomed the Colorado senator's hopes in 1987. Not long after, Bill Clinton's then-chief of staff Betsey Wright confronted him and told him to come clean with his wife, Wright wrote in emails now archived at the University of Arkansas.

"Some day I hope Hillary will understand why Bill and I developed such a tense relationship," Wright wrote in 1998.Wright declined interview requests.

A marital crisis erupted while Bill Clinton was governor, and Hillary Clinton's biographer Carl Bernstein wrote in A Woman In Charge that it involved his lengthy affair with a Little Rock woman.

Hillary Clinton may have become aware of her husband's straying, "but she never accepted it," said her longtime friend Ann Henry.

Hillary Clinton has been forthcoming about these painful early times. She told Talk Magazine in 1998 that the couple confronted his cheating in the late 1980s. "I thought he understood it, but he didn't go deep enough or work hard enough," she said.

Blair said Hillary Clinton realized that the infidelities threatened more than their marriage. "Her idea, I think, was, if he's going to be politically successful they have to become more conventional people who are more in tune with values of generations other than theirs," Blair said.

When Bill Clinton launched a presidential run in 1991, his wife and senior staff considered how to deal with what came to be known as "bimbo eruptions."

"I think, by then, Hillary had a very good notion of Bill's behavior," said her longtime friend Nancy Pietrafesa. "Maybe she endured it, but I don't think she condoned it."

Nevertheless, Hillary Clinton dismissed an accusation made by Gennifer Flowers, the singer who sold her story to a supermarket tabloid after having previously denied an affair. In an ABC News interview, she called Flowers "some failed cabaret singer who doesn't even have much of a résumé to fall back on." She told Esquire magazine in 1992 that if she had the chance to cross-examine Flowers, "I mean, I would crucify her."

Hillary Clinton's support for her husband was crucial, and she sat by his side during a crucial 60 Minutes interview, saying she was not like the victim in Tammy Wynette's "Stand By Your Man." Campaign pollster Stan Greenberg said at the time that the public would disregard the allegations if they believed he had been truthful to his wife.

Bill Clinton acknowledged a sexual encounter with Flowers six years later.

As other women emerged, Hillary Clinton helped forge aggressive defenses.

Former White House press secretary George Stephanopoulos recalled in his memoir discussing a woman's allegation published in Penthouse Magazine. He said that after her husband dismissed it as untrue during a meeting, Hillary Clinton said, "We have to destroy her story."

By July 1992, the campaign hired private detective Jack Palladino to investigate the accusers involved in two dozen allegations.

In 1994, former Arkansas state employee Paula Jones alleged in a lawsuit that Bill Clinton groped her in a hotel room three years earlier. Hillary Clinton wrote in her autobiography, Living History, that she erred in opposing an early settlement.

Eventually, Bill Clinton settled for $850,000. During discovery, Jones' attorneys found out about White House intern Monica Lewinsky.

Her husband denied the relationship, and Hillary Clinton blamed the allegations on a "vast right-wing conspiracy."

Asked on Good Morning America if her husband had been truthful, she said, "I know he has."

A former White House aide who spoke on the conditions of anonymity totalk about private discussions said Hillary Clinton blamed the scandal on political enemies and insisted that privacy was sacred.

Bill Clinton admitted his untruthfulness in August 1998.

Hillary Clinton wrote in her autobiography that her husband claimed Lewinsky had misinterpreted his attention. "It was such a familiar scenario that I had little trouble believing the accusations were groundless," she wrote.

A chill fell over the White House as the truth about Lewinsky emerged, former staffers and friends said.

"She had to do what she had always done before: swallow her doubts, stand by her man and savage his enemies," Stephanopoulos wrote, describing Hillary Clinton's reaction.

"I think it was obvious she was more than mad, more than upset," said Mary Mel French, a White House aide during the Clinton years. "She wasn't speaking to him. . . . It took a long time for that to settle down."

Hillary Clinton did not speak publicly about Lewinsky and confided in few people. Matthews, her Little Rock pastor, said he offered to listen, but she warned him that he might be subpoenaed.

"She's not the type of person who calls friends and cries about it," Henry said.

Hillary Clinton opened up to Blair's wife, Diane, a few weeks later, according to a diary kept by the now-deceased friend. "She thinks she was not smart enough, not sensitive enough, not free enough of her own concerns and struggles," Diane Blair wrote. "It was a lapse, but she says to his credit he tried to break it off, tried to pull away, tried to manage someone who was clearly a 'narcissistic loony toon;' but it was beyond control."

Lewinsky wrote in Vanity Fair in 2014 that she found Hillary Clinton's "impulse to blame the Woman — not only me, but herself — troubling." She declined an interview request.

Accuser Juanita Broaddrick, whose claim of a 1978 sexual assault has been denied by the Clintons, thinks Hillary Clinton was too passive. "I always felt if she'd been a stronger person . . . she could have done something about his behavior," she said.

Questions during Senate run

In 2000, while running for the U.S. Senate seat in New York, Hillary Clinton was asked whether she misled the public by defending her husband.

"It is something that I regret deeply that anyone had to go through," she said. "And I wish that we all could look at it from the perspective of history, but we can't yet."

In her treatment of the accusers, Trump has called Clinton an enabler.

Her friends say it's much more benign.

"I think she felt that she had committed her life to this guy," Jim Blair said. "They can debate politics from breakfast until bedtime and never get tired of it. She wanted to spend the rest of her life with him. She loved him. It's as simple as that."