President Trump on Tuesday insulted adult-film actress Stormy Daniels by calling her “Horseface,” the latest example in his long-standing pattern of attempting to undercut female adversaries with jabs at their physical appearance.

Daniels and her attorney Michael Avenatti, a possible 2020 presidential contender who has aggressively criticized Trump, responded with mocking references to Trump’s genitals and accused him of hating women.

The remarkably crude spat on Twitter — which began with Trump cheering the dismissal of Daniels’s defamation lawsuit against him — represented the third time in as many weeks that the president has gone out of his way to attack a woman whose interests or views are at odds with his. The episode also comes just three weeks before the midterm elections, where Republicans are struggling to attract female voters, particularly in the suburbs, in defense of their majorities in Congress.

Most Republican lawmakers stayed silent about Trump’s attack, with a few offering muted criticism.

“To say this is unbecoming of any man, let alone the POTUS, is a vast understatement,” Rep. Ryan Costello (R-Pa.) tweeted. “And to say this enables teenage boys to feel they have a license to refer to girls [with] such names is obvious. It’s all very embarrassing.”

It was not clear if Trump would suffer immediate repercussions — except perhaps in the midterms — but the tenor of the insults again underscored his tendency to barrel past the traditional boundaries of presidential discourse.

“It’s ‘Trash-talking Tuesday’ in the Oval,” said Timothy Naftali, NYU presidential historian and co-author of “Impeachment: An American History.” “President Trump appears to be a transactional person. . . . He’s not going to change his conduct unless he starts paying a political or economic price.”

Even before he entered the White House, Trump frequently used his public platform to target individual women in personal terms for criticism. Arianna Huffington? “Extremely unattractive.” Rosie O’Donnell? “Fatass,” “ugly,” a “slob.” Heidi Klum? “No longer a 10.”

The habit continued as he turned his focus to politics.

In September 2015, Trump was quoted mocking the appearance of former business executive Carly Fiorina, then a rival for the GOP presidential nomination.

“Look at that face,” Trump reportedly said as he watched Fiorina give a television interview. “Would anyone vote for that? Can you imagine that, the face of our next president?”

In March 2016, Trump insulted Heidi Cruz, wife of then-rival Sen. Ted Cruz (R-Tex.), by tweeting an unflattering photo of her next to a glamour shot of Melania Trump. “The images are worth a thousand words,” the caption read.

Two-and-a-half years later, Trump is preparing to host a rally for Ted Cruz next week in Houston as he defends his seat against Rep. Beto O’Rourke (D-Tex.).

Throughout the presidential campaign, Trump also said Democratic nominee Hillary Clinton did not have the right “look” to be president. “When she walked in front of me, believe me, I wasn’t impressed,” he said at a North Carolina rally in October 2016.

Asked by the Associated Press on Tuesday if it was appropriate to insult a woman’s appearance as he did with Daniels, Trump responded, “You can take it any way you want.”

Trump’s comments contrast sharply with his public attacks on men as “lyin’,” “crazy” or “low energy.” Rarely does Trump insult a man’s appearance, and seldom in the cutting personal terms he reserves for women.

In addition to Daniels, Trump recently mocked Christine Blasey Ford, the first woman to accuse Brett M. Kavanaugh of sexual assault during his Supreme Court confirmation process, and Sen. Elizabeth Warren (D-Mass.), a possible presidential rival in 2020.

On Monday, Trump responded to Warren’s release of a DNA test suggesting she had a distant Native American ancestor by repeating his regular slur of her as “Pocahontas.” He falsely denied having offered to donate $1 million to charity in July if Warren could offer DNA proof of Native American ancestry and said he would only make a donation now “if I can test her personally.”

“That will not be something I enjoy doing, either,” he added.

Responding on Twitter, Warren condemned Trump for making “creepy physical threats.”

Attacks on women did not prevent Trump from winning support from 53 percent of white women in 2016, although he lost women overall to Clinton, according to exit polls.

But his latest attacks come as Republicans increasingly worry about losing the House in the upcoming midterms, an outcome that would diminish Trump’s power to enact his agenda. Suburban white women are seen as a key voting bloc that could help Democrats take control of the lower chamber.

Republican strategists disagree on how much the president’s rhetoric and behavior will actually harm his party’s chances in November.

“My initial thought is this falls into the category of things that are not an issue for any Republican candidate not named Donald J. Trump,” said Michael Steel, a Republican strategist. “Each local elected official, Republican or Democrat, is trying to do the best they can for their voters and have nothing to do with this sideshow.”

At the same time, many Republican voters have said they dislike Trump’s tweets.

“I’ve been to focus groups where they say they like the president’s policies but wish he wouldn’t tweet so much,” said Alex Conant, a GOP strategist who served as a senior adviser to Sen. Marco Rubio’s (R-Fla.) 2016 presidential campaign. “To the extent the election is about his personality instead of his policies, that’s problematic with a lot of voters.”

Rubio tried for a brief period in early 2016 to give Trump a taste of his own medicine, criticizing his “spray tan” and “small hands.”

“You know what they say about guys with small hands,” Rubio told rallygoers in Salem, Va., drawing laughter and applause.

Rubio later called the remark a mistake and apologized to Trump.

“It wasn’t consistent with how voters perceived him. People thought it was forced and inauthentic,” Conant said.

Tuesday’s Twitter exchange followed a legal defeat for Daniels and Avenatti, whose defamation lawsuit against Trump was dismissed by U.S. District Judge S. James Otero on Monday. Daniels had argued that Trump defamed her by suggesting she lied when she said she was threatened not to speak about their alleged relationship.

Still pending is another Daniels lawsuit, which seeks to void a 2016 nondisclosure agreement meant to prevent Daniels from discussing her alleged affair with Trump.

Citing a Fox News headline about Otero’s ruling, Trump tweeted around 11 a.m.: “Great, now I can go after Horseface and her 3rd rate lawyer in the Great State of Texas. . . . She knows nothing about me, a total con!”

Trump aides and outside advisers were generally exasperated by the tweet, describing it in interviews as unplanned. At the same time, they said, Trump had previously been dismissive of Daniels in private so it was not entirely surprising when some of that sentiment spilled into public view.

Avenatti responded by calling Trump a “disgusting misogynist,” an “embarrassment to the United States” and a “complete shyster and liar.” In one tweet, Avenatti referred to his client’s claim that Trump’s affair with her happened in 2006, shortly after Melania Trump gave birth to their son, Barron.

“How many other women did you cheat on your wife with while you had a baby at home?” Avenatti tweeted.

Trump has denied Daniels’s claim of an affair.

Avenatti, who says he is deciding whether to run for president in 2020, has launched a political action committee and is using his national profile to promote Democratic candidates around the country. His advice to Democrats has been to fight fire with fire when it comes to Trump.

“If Avenatti is the Democratic nominee in 2020, the tone of that race will make the events of 2016 seem like the Lincoln-Douglas debates by comparison,” Steel said.

Daniels responded to the “Horseface” tweet by referring to Trump as “Tiny” and saying he “perhaps” has a “penchant for bestiality,” an apparent reference to the equine insult.

“Ladies and Gentlemen, may I present your president. In addition to his . . . umm . . . shortcomings, he has demonstrated his incompetence, hatred of women and lack of self control on Twitter AGAIN!” she tweeted.

Daniels shared explicit details of her alleged affair with Trump in her recently released book, including a purported — and unflattering— description of his genitals. Daniels has also shared similar details in recent media interviews.

One informal White House adviser suggested Daniels’s claims have caused tension between Trump and his wife.

“The reason I cared about Stormy is because it affects Melania, which affects him, which affects a lot of us,” this person said. “I think the reason he denied a lot it from the beginning was not political, but because it so affects Melania.”

One White House official noted that while the president’s supporters don’t always love his rhetoric or his use of Twitter, they generally appreciate Trump fighting back when he is attacked and could be energized by Tuesday’s back-and-forth.

Trump has defended his attacks on women such as Ford, recently telling CBS’s “60 Minutes” that his decision to mock her helped ensure Kavanaugh’s confirmation.

“Had I not made that speech, we would not have won,” Trump said in an interview that aired Sunday.

“Do you think you treated her with respect?” asked interviewer Lesley Stahl.

Trump said, “I think so,” then cut off Stahl’s line of questioning.

“You know what? I’m not going to get into it because we won. It doesn’t matter. We won.”