President Donald Trump and the head of the law firm Paul, Weiss, Rifkind, Wharton & Garrison LLP have reached a deal under which Trump will drop the executive order he leveled against the firm, Trump said Thursday.

In the deal, Trump said, the firm agreed to a series of commitments, including to represent clients no matter their political affiliation and contribute $40 million in legal services to causes Trump has championed, including “the President’s Task Force to Combat Antisemitism, and other mutually agreed projects.”

It’s unclear how the money will be used to help the task force. The firm also said it agreed to conduct an audit to ensure its hiring practices are merit based.

The deal was reached after the head of the firm, Brad Karp, went to the White House this week and had a face-to-face meeting with Trump to discuss a resolution. Members of the legal profession said in interviews that they were surprised by the deal, as it appears as if the firm — which is dominated by Democrats — was capitulating to Trump over an executive order that is likely illegal.

The White House said that Karp had acknowledged “wrongdoing” by one of the firm’s former partners, Mark F. Pomerantz. Pomerantz had tried to build a criminal case against Trump several years ago while working at the Manhattan district attorney’s office. It was not clear what wrongdoing Trump was referring to.

“The president is agreeing to this action in light of a meeting with Paul, Weiss Chairman, Brad Karp, during which Mr. Karp acknowledged the wrongdoing of former Paul, Weiss partner, Mark Pomerantz, the grave dangers of Weaponization, and the vital need to restore our System of Justice,” the White House said.

The agreement is a significant development in the retribution campaign Trump has opened against several top law firms that he sees as having supported efforts to help his opponents or unfairly prosecute him. And it is the latest demonstration of how Trump has used his power to extract concessions or public signs of support for his agenda from corporate leaders, news organizations and others since his election victory in November.

The deal applies only to the executive order against Paul, Weiss. It’s not clear what effect, if any, it will have on the orders targeting other firms or whether it will lead Trump to back off his stated intention to go after more of them.

Among the many accusations Trump and his allies have leveled at big law firms, like Paul, Weiss, is that they refused to represent conservative defendants like Trump because of their politics. In the meeting, Karp said that his firm — which has done legal work for Trump allies like Rupert Murdoch’s Fox — would represent clients no matter their political affiliations.

The firm has a stable of Democratic-leaning partners and has prominent former Obama administration officials in its ranks. Karp helped host a “Lawyers for Biden” fundraiser for President Joe Biden’s reelection campaign in 2023 and one of its top lawyers oversaw then-Vice President Kamala Harris’ preparation for her debate with Trump.

As part of the agreement, the firm committed to working with the administration on helping veterans, combating antisemitism, and on fairness in the justice system.

In a statement posted on social media by Trump, Karp said he is looking forward “to an engaged and constructive relationship with the president and his administration.”

This year, Meta, the parent company of Facebook, agreed to pay $25 million to settle a lawsuit Trump filed in 2021 over the suspension of his Facebook and Instagram accounts after the Jan. 6, 2021, riot at the Capitol. In that case, most of the money went to Trump’s future presidential library.

ABC News agreed in December to pay $15 million to settle a defamation lawsuit Trump brought, with the money also going to his presidential library fund.

Trump’s executive orders targeting top law firms introduced a new element to his retribution campaign. They have raised deep concerns among legal experts and threatened to pose serious financial problems for the firms, creating a chilling effect that has deterred them from taking on clients at odds with the administration.

The first order targeted Covington & Burling, a large firm that had done legal work for Jack Smith, who as special counsel during the Biden administration brought two indictments against Trump.

Last week, a federal judge in Washington ruled that a subsequent executive order Trump signed targeting the law firm Perkins Coie, which is also aligned with Democrats, was likely unconstitutional and issued a restraining order halting it.

But two days later, Trump signed a nearly identical executive order against Paul, Weiss. Trump said he was taking the action to punish the firm for its ties to a lawyer who had pushed for him to be indicted and another who had brought a lawsuit against Jan. 6 rioters.