PHILADELPHIA — More than 40 lawsuits filed in recent days by state attorneys general, unions and nonprofits seek to erect a bulwark in the federal courts against President Donald Trump’s blitzkrieg of executive actions that have upended much of the federal government and challenged the Constitution’s checks and balances.

Unlike the opening of Trump’s first term in 2017, little significant resistance to his second term has arisen in the streets, the halls of Congress or within his own Republican Party. For now at least, lawyers say, the judicial branch may be it.

“The courts really are the front line,” said Skye Perryman, CEO of Democracy Forward, which has filed nine lawsuits and won four court orders against the Trump administration.

The multipronged legal pushback has already yielded quick — if potentially fleeting — results. Judicial orders in nine federal court cases will, for a time, partially bind the administration’s hands on its goals. Those include ending automatic citizenship for babies born to immigrants living on U.S. soil without legal permission; transferring transgender female inmates to male-only prisons; potentially exposing the identities of FBI personnel who investigated the Jan. 6, 2021, attack on the Capitol; coaxing federal workers to accept “deferred resignation” under a tight deadline; and freezing as much as $3 trillion in domestic spending.

On Friday afternoon, Judge Carl Nichols, a district judge nominated by Trump, said he would issue a temporary restraining order halting the administrative leave of 2,200 employees at the U.S. Agency for International Development and the looming withdrawal of nearly all of the agency’s workers from overseas.

Late Friday, Judge John Bates, a nominee of President George W. Bush, rejected a request by a coalition of unions for an emergency order blocking Elon Musk’s team from accessing Labor Department data. While that case is ongoing, Bates’ ruling was the first victory for Trump’s new administration in federal court. In the early hours of Saturday, U.S. District Judge Paul Engelmayer, one of President Barack Obama’s nominees, restricted access by Musk’s government efficiency program to the Treasury Department’s payment and data systems, saying access would risk “irreparable harm.”

Judges have not minced words. In Seattle last week, a district judge issued the second nationwide injunction blocking Trump’s order to end universal birthright citizenship. “The Constitution is not something with which the government may play policy games,” Judge John Coughenour said, and such a change could be made only through amending the Constitution. “That’s how the rule of law works.”

But while the executive branch is entrusted with the capacity for swift, decisive action, the judiciary is slow by design, and the legal opposition to Trump’s opening moves may struggle to keep up with his fire hose of disruption.

Trump’s first three weeks in office have yielded scores of executive orders to upend U.S. foreign aid, domestic spending and social policy, many in open defiance of the law. Without buy-in from or even consultation with the legislative branch, the president has wielded unilateral executive power in an attempt to dismantle parts of the government, override regulations governing civil service, overturn more than a century of precedent on immigration law, seek possible vengeance on his perceived enemies, and roll back liberal advances made in diversity and equity and transgender rights.

“No president should be able to rewrite 120-plus years of interpretation of the Constitution with a stroke of a pen,” Oregon Attorney General Dan Rayfield said. “That is the existential threat.”

Some legal experts see the executive branch’s intentional effort to push the boundaries of legality as a bare-knuckle strategy to overwhelm the president’s opposition and eventually win at least some precedent-shattering decisions from the conservative Supreme Court.

“The administration seems to have wanted challenges that consume a ton of resources — of opponents, courts and public attention — even as members of the administration know the provisions do not square with the law that exists,” said Judith Resnik, a professor at Yale Law School.

To Trump’s backers, the president’s orders are well within the powers outlined in the Constitution’s second section on the executive branch. “President Trump is not stealing other branches’ powers,” said Mike Davis, who heads the Article III Project, a conservative advocacy group. “He is exercising his Article II powers under the Constitution. And judges who say he can’t? They’re legally wrong. The Supreme Court is going to side with Trump.”

The ascent of some cases through the trial courts, to the appellate courts and then to the Supreme Court could take months. Those lengthy battles will also be political, pitting a president who sees himself as the almost invincible leader of a populist movement against attorneys general.

The one surprise factor? Musk, the billionaire who has been handed extraordinary — and possibly illegal — powers to cut and reshape the government, with no real title or Senate confirmation. “I’m not even sure Trump knows what he is doing,” said Matthew Platkin, New Jersey’s attorney general. “He’s an unelected billionaire running around government, slashing huge amounts of the workforce.”

In legal filings, the Justice Department has argued that Musk’s associates are under the authority of acting Cabinet members.