Attorney General William P. Barr repeatedly pressured then-U.S. Attorney Geoffrey S. Berman to resign last month and take another job — including as chairman of the Securities and Exchange Commission — to clear the way for President Trump to install a political ally as the leader of the powerful federal prosecutors’ office in Manhattan.

Berman, who testified privately before the House Judiciary Committee on Thursday, described in a written statement the unusual sequence of events that led to his departure June 20.

“The Attorney General said that if I did not resign from my position I would be fired,” he said in his statement, a copy of which was obtained by The Washington Post. “He added that getting fired from my job would not be good for my resume or future job prospects. I told him that while I did not want to get fired, I would not resign.”

Barr urged Berman to step aside, saying that if he did not, he would be fired, according to the statement. Portions of the ­statement were first reported by ­Axios.

In addition to discussing the SEC chairmanship, Barr also offered Berman a job as head of the Justice Department’s Civil Division; Berman was not interested in either position.

The revelation of Barr’s pressure tactics adds to the picture of what was already known about the extraordinary turn of events that culminated in Berman stepping down amid suspicions that he was being ousted for political reasons. The administration’s critics have said they believe that Trump wanted him gone because Berman’s prosecutors had been investigating the president’s allies, including Trump’s personal lawyer Rudolph W. Giuliani.

Thursday’s closed-door session is part of the committee’s inquiry into Barr’s management of the Justice Department and what Democrats deem his “unprecedented politicization” of the historically apolitical agency. Barr, who has been criticized for intervening in cases of personal consequence to the president, is due to testify publicly before the committee at the end of July.

After Berman’s testimony ended, the committee’s chairman, Jerrold Nadler (D-N.Y.), told reporters, “We don’t know yet if the attorney general’s conduct is criminal, but that kind of quid pro quo is awfully close to bribery.”

Committee Republicans dismissed the testimony of Berman, a lifelong Republican and a party donor. “Berman provided no testimony today that any case involving the president or any other human being was at all a part of the decision to move him out of the Southern District,” Rep. Matt Gaetz (R-Fla.) said.

Berman had informed the panel in advance that he would not discuss ongoing investigations or speculate on the reasons for his removal.

The Justice Department declined to comment Thursday on Berman’s statement and referred to previous Barr remarks. In an NPR interview last month, Barr said Berman, who was appointed to the position by federal judges, “was living on borrowed time from the beginning.”

He said that “when a really strong, powerful candidate raised his hand” for the U.S. attorney job, referring to SEC Chairman Jay Clayton, Barr saw “an opportunity to put in a very strong person as a presidential appointment to that office.”

Berman’s testimony shed light on the increasingly fraught relationship between the Southern District of New York — which prides itself on its prosecutorial independence — and a president who demands absolute fealty from officials within the executive branch.

Trump’s intended nominee, Clayton, has no experience as a federal prosecutor — a point Berman made to Barr. Senate Republicans have indicated they are unlikely to move ahead on the nomination.

Berman’s departure capped a dizzying set of developments that began at 12:10 p.m. June 19, a Friday, when Berman — at the attorney general’s request — met Barr for roughly 45 minutes in a suite at the Pierre hotel in Manhattan.

Barr said that he “wanted to make a change in the Southern District of New York,” Berman wrote. Sandwiches were on the table, but nobody ate. Barr said there was an opening as the head of the department’s civil division and asked Berman to take that job, saying that it would create an opening for Clayton.

Berman responded that he “loved” his job and asked the attorney general if he were “in any way dissatisfied” with his performance. Barr said he was not and the move was “solely prompted by Jay Clayton’s desire to move back to New York” and the “administration’s desire to keep him on the team.”

Berman told Barr he knew and liked Clayton but “he was an unqualified choice.”

Barr repeatedly urged Berman to take the civil division position. Berman declined and said he would leave when a nominee was confirmed. He told Barr there were important investigations he wanted to see through to completion.

During the meeting Barr asked Berman for his cellphone number. Berman gave him his personal number but told him his position “would not change this afternoon or in the future.”

After the meeting, Berman called attorneys who might represent him if he were fired. He wanted to be ready to challenge the firing, he said, on the grounds that he was appointed by the court so could not be fired by the attorney general or the president.

Later that evening he had a brief call with Barr in which Barr raised the possibility of the SEC chairman position. Berman demurred. He asked to delay a final conversation until Monday so he could discuss the situation with his senior aides. Barr said he did not understand why Berman needed to confer with aides.

“This is about you,” Barr said. Replied Berman, “It’s about the office.”

That was the last time the two men spoke.

At 9:15 that night, in a surprise move, Barr announced that Berman was stepping down, that Trump planned to nominate Clayton to take his place and that the president would appoint the U.S. attorney for the District of New Jersey, Craig Carpenito, to oversee the New York office in an acting capacity in the interim.

Appointing Carpenito as acting U.S. attorney “would have been unprecedented, unnecessary and unexplained,” Berman wrote.

About two hours later, Berman fired back, saying he had not resigned and intended to stay in his job until a nominee was confirmed to ensure the office’s investigations “continue unimpeded.”

At 1 a.m., he sent a message to his staff of more than 200 attorneys. “Please know that my only concern is protecting this office and your work,” the message said. “It is the privilege of a lifetime to be your U.S. attorney and I will do everything in my power to honor the trust you have given me.”

The standoff lasted through much of that Saturday.

At about 3:30 p.m., Barr released a letter he had sent to Berman notifying him that he had been fired by the president.

In what Berman called a “critical concession,” Barr stated that Berman’s deputy, Audrey Strauss, and not Carpenito, would serve as acting U.S. attorney until a successor could be confirmed.

“With that concession and having full confidence that Audrey would continue the important work of the office, I decided to step down and not litigate my removal,” he wrote.

Berman, 60, was appointed U.S. attorney on an interim basis by then-Attorney General Jeff Sessions in January 2018. He had been a federal prosecutor in Manhattan from 1990 to 1994. When 120 days had passed without the president nominating a permanent U.S. attorney, the judges of the Southern District stepped in and appointed Berman to the job, pursuant to federal law.

Over the ensuing months Berman’s office brought a number of high-profile cases that involved Trump associates, including convicting the president’s former personal attorney Michael Cohen of tax evasion, campaign finance violations and lying to Congress. Last October, Southern District prosecutors charged two Trump and Giuliani associates, Lev Parnas and Igor Fruman, with scheming to funnel foreign money to U.S. politicians while trying to influence U.S.-Ukraine relations.

Analysts have noted that if Trump sought to replace Berman with a more malleable U.S. attorney, the effort backfired. Strauss, colleagues say, possesses the experience and acumen to guide the office through turbulent times while upholding its long tradition of independence.

A registered Democrat, she was an assistant U.S. attorney in the Southern District from 1976 to 1983. While there, she bested defense attorney and political fixer Roy Cohn, a man Trump has called a mentor, in his attempt to overturn convictions of two Mafia members. Strauss later served on the staff of the independent counsel investigating the Iran-contra affair.