A White House speechwriter resigned Friday after his former wife claimed that he was violent and emotionally abusive during their turbulent 2½ -year marriage — allegations that he vehemently denied, saying she was the one who victimized him.

The abrupt departure of David Sorensen, a speechwriter who worked under senior policy adviser Stephen Miller, came as The Washington Post was reporting on a story about abuse claims by his ex-wife, Jessica Corbett. Corbett told The Post that she described his behavior to the FBI last fall as the bureau was conducting a background check of Sorensen.

White House officials said they learned of the accusations by Sorensen’s wife Thursday night, before The Post contacted the White House for comment.

“We immediately confronted the staffer, he denied the allegations and he resigned today,” spokesman Raj Shah said in a statement Friday evening.

In a text message to The Post, Sorensen said he stepped down because he “didn’t want the White House to have to deal with this distraction.”

“It should be able to focus on continuing President Trump’s historic accomplishments for the American People,” he texted.

Sorensen’s resignation comes two days after another administration official, staff secretary Rob Porter, departed after two ex-wives said that he physically abused them. Senior White House officials and the FBI knew about the allegations for months, raising questions about why he was allowed to remain in his post.

Administration officials said Sorensen’s position as a speechwriter at the Council on Environmental Quality, a division of the Executive Office of the President, did not require a security clearance. His background check was ongoing, they said. The FBI declined requests for comment.

Corbett first contacted The Post a week before Porter’s case became public. She said that during her marriage to Sorensen, he ran a car over her foot, put out a cigarette on her hand, threw her into a wall and grasped her menacingly by her hair while they were alone on their boat in remote waters off Maine’s coast, an incident she said left her fearing for her life. During part of their marriage, he was a top policy adviser to Republican Maine Gov. Paul LePage.

She said she did not report her abuse allegations to police because of Sorensen’s connections to law enforcement officials.

Corbett said several of the incidents involved alcohol and acknowledged that she slapped Sorensen a number of times after he called her a vulgar term.

Two friends and associates of Corbett said she confided in them during the marriage that her husband was abusive. Corbett also provided records of text messages and emails in which Sorensen berated her with vulgar language and she discussed the deteriorating marriage with others. She gave The Post a photo of her hand bearing a scar she said was from the cigarette burn.

In a lengthy statement, Sorensen said he had “never committed violence of any kind against any woman in my entire life.”

“In fact, I was the victim of repeated physical violence during our marriage, not her,” he added, saying he had consulted with an attorney and was “considering legal options to address her defamation.”

Sorensen alleged that Corbett punched him on multiple occasions. After one such episode, he said, he attempted to leave in his car and she ran after him as he was pulling away, injuring herself in the process.

In another incident, he said, she grabbed the steering wheel as he drove on a highway and punched him in the face during an argument.

Sorensen provided photos of what he said were injuries his ex-wife inflicted upon him during their fights, including bruises and scrapes.

He said that while he had hoped never to have to discuss his ex-wife and their tumultuous marriage, “this incident is an opportunity to highlight the grossly underreported and unacknowledged issue of female-on-male domestic violence.”

In response to Sorensen’s allegations Friday evening, Corbett maintained that her violence never escalated beyond slapping him. “Everything I told you is 100 percent true and that is why he had to resign today,” she said.

The couple’s uncontested divorce became final in September, according to records reviewed by The Post.

Corbett said she detailed her abuse allegations to an FBI agent who came to her home to interview her on Oct. 5, 2017, as part of Sorensen’s background check process.

A Maine Republican operative, who spoke on the condition of anonymity out of fear of political retribution, said he talked to Corbett shortly before her meeting with the FBI that day.

“She told me she was a little nervous about what to tell them,” he said. “She told me later that she told them the truth.”

In one of several interviews with The Post, Corbett called it “scary” that someone like her ex-husband had access to the White House after what she told the FBI.

“Everyone can think you’re the most wonderful guy, but you’re throwing women into walls by night,” she said.

For his part, Sorensen said that “like many domestic abusers, she was especially adept at controlling her rage so that no others witnessed her physical attacks.”

During their marriage, Corbett and Sorensen were a well-known couple in the small world of Maine Republican politics.

Corbett said she worked for Sen. Marco Rubio of Florida in his first Senate bid and on former House speaker Newt Gingrich’s 2012 presidential campaign before becoming finance director for Rep. Bruce Poliquin’s (R-Maine) successful 2014 House bid. Sorensen, a former spokesman for Maine House Republicans and the state party, was also a spokesman for the Maine Department of Health and Human Services.

The couple were in the LePage family’s social and professional orbit.

On Oct. 17, 2015, Corbett served as a bridesmaid in the wedding of LePage’s daughter, Lauren. Late that night, Corbett said, Sorensen threw her into a wall during an argument.

After the incident, Corbett texted her mother saying she wanted to leave the marriage and admitting she had thoughts of suicide.

“He’s killing me,” she wrote of Sorensen in a message later that month reviewed by The Post.

At the time, Sorensen’s career was on the fast track. On Nov. 18, a month after Lauren LePage’s wedding, the governor hired Sorensen as a policy adviser whose portfolio included domestic violence. Gov. LePage has called domestic abuse, which he suffered as a child,“the most heinous of all crimes in society.” Domestic violence accounts for roughly half of Maine’s homicides, according to state statistics.

Corbett said she confided in Lauren LePage about the alleged abuse and pleaded with her to encourage her father to talk to Sorensen.

In a statement, Lauren LePage said that while she was aware of problems in their marriage, she “neither witnessed or saw any evidence of domestic abuse.”

In a statement, LePage spokeswoman Julie Rabinowitz said the governor “has a zero-tolerance policy regarding domestic abuse,” adding that no accusations or evidence of domestic violence on the part of Sorensen were ever brought to the attention of LePage, his wife or the governor’s staff.

Mauranda Stahl, Sorensen’s first wife, wrote in an email that she had never known him to be violent or abusive since meeting him 10 years ago.

“In those years he never raised a hand to me or exhibited any behavior consistent with Jessica’s accusations,” she wrote in response to an inquiry by The Post. “Because of that I have a difficult time believing there is any validity to those claims.”

Joanne Fryer, a Maine attorney and a friend of Sorensen, said she asked Corbett during their divorce if there had been physical violence in their relationship and that Corbett said no.

“We think the world of Dave, quite frankly,” Fryer said.

Corbett said she told Fryer what she seemed to want to hear.

“I was scared,” she said. “I wanted help but wasn’t willing to admit how bad it was because I didn’t feel safe.”

Friends of Corbett said she felt trapped in the relationship because of Sorensen’s pull in Maine politics.

“She was in a situation where everyone was on David’s side because of who he was and who he worked for,” said John Bremer, a close friend and Washington, D.C., resident who Corbett confided in about the abuse. Bremer said Corbett told him that Sorensen ran over her foot and yanked her hair on their boat around the time of the alleged episodes.

Bremer helped Corbett create a bank account outside of Sorensen’s control that she could use to escape the marriage. He said it was clear from her tearful phone calls that “this was a woman who was going through abuse.”

“These were very vivid and intense calls I would get,” he said. “It’s not something you can fake or come up with.”

Another friend, a female lawmaker from South Carolina who roomed with Corbett at the 2016 Republican National Convention in Cleveland, said that she had confided in her about the state of her marriage. Later that year, she spent months unable to reach Corbett, which left her fearing the worst.

“I was really, really worried about her,” said the lawmaker, who spoke on the condition of anonymity out of fear of political reprisals. Occasionally, she said, she’d get a message saying, “I’m okay, I’m still alive and I’ll let you know.”