President Trump had been on a winning streak on immigration, but that progress is suddenly imperiled after a series of court setbacks and the departure of acting Homeland Security Secretary Kevin K. McAleenan, the architect of much of the recent success.

Mr. Trump announced that Mr. McAleenan was out Friday evening, capping off a day that saw three different judges rule against the president on immigration.

One federal court in Texas erected a new hurdle to Mr. Trump’s wall building plans, ruling the border emergency proclamation the president issued in February — which he’s using to siphon Pentagon money toward the wall — is illegal.

Federal judges in New York and California also ruled against Mr. Trump’s new policy cracking down on immigrants who are in the U.S. illegally and use public benefit programs such as Medicaid, finding that he not only cut too many procedural corners but was likely breaking immigration law, too.

Judge George B. Daniels, a Clinton appointee on the court in New York, said the policy’s attempt to reward would-be immigrants who spoke English was “simply offensive,” and said the other new tests have “absolutely no support in the history of U.S. immigration law.”

“The rule is simply a new agency policy of exclusion in search of a justification. It is repugnant to the American Dream of the opportunity for prosperity and success through hard work and upward mobility,” he wrote.

He ordered a nationwide halt to the “public charge” policy, which was to take effect this week.

Another judge in California issued a similar, though more limited ruling on the same topic.

The public charge rule, which Mr. McAleenan and acting Citizenship and Immigration Services Director Ken Cuccinelli had pushed through earlier this year, was supposed to be a marquee move in Mr. Trump’s effort to try to limit the drain some legal immigrants pose on taxpayers.

White House press secretary Stephanie Grisham called the decisions “inexplicable,” and complained they’re part of an anti-Trump spate of decisions.

Another came Friday when Judge David Briones, a Clinton appointee to the bench in western Texas, ruled that Mr. Trump’s border emergency declaration — which he said gave him the power to shift money around within the federal budget — was illegal.

He said Congress took clear steps to try to limit how much border wall Mr. Trump could build in 2019, and the president’s attempt to funnel Pentagon funds toward wall construction disrupts Congress’s power over spending.

“The president’s proclamation is unlawful,” he wrote.

But he didn’t issue an immediate injunction, saying he wants to hear more briefing about how to craft such an order.

The adverse rulings were all the more striking because Mr. Trump had been notching wins on immigration, and had made headway on cutting into the record levels of migrant families who had been surging across the border earlier this year.

Key to cutting the numbers was a Trump policy that sent tens of thousands of would-be asylum-seekers back to wait in Mexico while their cases are heard in the U.S.

Known official as the Migration Protection Protocols, and unofficially as the “Remain-in-Mexico” policy, it undercut migrants who’d planned to make bogus asylum claims and were counting on a years-long backlog of cases to given them a chance to gain a foothold in the U.S. while they waited for their hearings.

That policy was spearheaded by Mr. McAleenan.

So were a series of agreements with Honduras, El Salvador and Guatemala, the three countries mostly responsible for the migrant surge. Each of them has promised to do more to keep their own people from fleeing — and to help block others who cross their territory en route to the U.S.

Despite those gains, Mr. McAleenan had a tenuous relationship with some in the White House during his six months in office, and some Trump allies had predicted last month that his time would soon be up.

Mr. Trump announced the upcoming departure via tweet Friday night and Mr. McAleenan promised “a smooth transition.”

Neither the president’s tweet nor Mr. McAleenan’s statement suggested he was pushed out, and both were gracious toward each other, though Democrats still suspected Mr. Trump gave a push.

Rep. Bennie G. Thompson, Mississippi Democrat and chairman of the House Homeland Security Committee, called it an “ouster.”

“This will only add to the chaos for a Department where there are chronically too many leadership vacancies and positions held by unconfirmed, ‘acting’ officials,” he said.

Indeed every top immigration post in the department is held by an acting official now.

The president promised to announce a replacement this week, and Mr. Cuccinelli is the front-runner, having pushed through a series of big policies — including the public charge rule — in his months at the helm.

Another possibility could be former Kansas Secretary of State Kris Kobach, who brings more immigration experience to the job.

Mr. Kobach and Mr. Cuccinelli were in an unofficial competition earlier this year for an immigration czar post the president was contemplating.

Sign up for Daily Newsletters Manage Newsletters

Copyright © 2020 The Washington Times, LLC. Click here for reprint permission.