WASHINGTON — Two major law firms fighting President Donald Trump’s assault on their business appeared in court Wednesday with the aim of putting a decisive end to his retribution campaign against them.

The two firms, Perkins Coie and WilmerHale, have asked the courts to permanently block executive orders issued by Trump declaring them a national security risk, which curtails their ability to do high-level legal work. The firms, which have clients and employ lawyers whom Trump opposes politically, have argued that the orders are so blatantly unconstitutional that no trial is necessary.

The judges presiding over their cases, Beryl A. Howell and Richard J. Leon of the U.S. District Court in Washington, were under no obligation to act immediately after the hearings Wednesday. But the legal community is intensely interested in how these two cases proceed, after the president’s executive orders and threats caused a deep rift of the world of elite corporate firms.

“Simply put, blacklisting and sanctioning law firms for representing the president’s political opponents, devoting resources to causes the president dislikes or hiring attorneys who have investigated the president is anathema to our constitutional order,” attorneys representing WilmerHale wrote in a filing requesting the speedy resolution of the case.

The government has asked that the lawsuits be dismissed, arguing that the orders were all within the president’s authority, and an expression of political speech.

Perkins Coie and WilmerHale were singled out in March by Trump for punishment with individualized executive orders, owing largely to past legal work on behalf of clients opposing Trump and policies he had championed.

Among other things, the orders directed federal agencies not to contract with the firms or permit their staff into federal buildings, and to suspend security clearances held by their attorneys.

Both firms had been involved in investigations concerning Russian disinformation during the 2016 election, and the question of whether Russian influence had been designed to benefit Trump’s campaign. And both noted in court filings that the president himself had said repeatedly that he had singled them out specifically because of their previous clients.

“The president openly proclaims that he is targeting WilmerHale for representing his political opponents in election-related litigation, challenging his immigration-enforcement policies, associating with his perceived enemies (including a special counsel appointed by the president’s own Justice Department) and defending a client’s race-conscious college admission policies,” lawyers representing WilmerHale wrote.

As it became clear that the White House was poised to retaliate against firms that had tangled with Trump in the past, a host of top legal firms raced to cut deals with the president.