Protesters participate in a 2017 rally to oppose President Trump’s order to end the Obama-era Deferred Action for Childhood Arrivals program. (Ethan Miller/Getty Images)

A federal appeals court ruled Friday that the Trump administration had been “arbitrary and capricious” in its bid to end an Obama-era program that shields young undocumented immigrants from deportation.

The U.S. Court of Appeals for the 4th Circuit partially reversed an earlier ruling in the case brought by the immigrant advocacy organization CASA de Maryland.

In a 2-to-1 decision, the court said the government had failed to “give a reasoned explanation for the change in policy, particularly given the significant” interests involved, according to the majority opinion written by Judge Albert Diaz and joined by Judge Robert King.

The decision is similar to one reached by the U.S. Court of Appeals for the 9th Circuit. The Trump administration has asked the Supreme Court to intervene. But the request has been pending for months, and the justices have stopped putting the case on their weekly discussion list.

It is expected that the Supreme Court will have to deliver the final word on the program, called Deferred Action for Childhood Arrivals, or DACA, most likely in the term that begins in October. It could be that the justices are waiting for all of the appeals courts considering the issue to weigh in; another case challenging the administration’s DACA decision has been argued in the U.S. Court of Appeals for the D.C. Circuit.

In the case decided Friday, Judge Julius N. Richardson said in his dissent that the administration had acted within its authority and noted the limited role of the judiciary.

“It is not our place to second-guess the wisdom of the discretionary decisions made by the other branches. The rescission of DACA was a controversial and contentious decision, but one that was committed to the executive branch,” wrote Richardson, who was recently named to the court by President Trump. Diaz was nominated by President Barack Obama, and King by President Bill Clinton.

The Justice Department declined to comment on the ruling Friday.

“We recognize the struggle is not over and there are more battles to fight in the Supreme Court on this road to justice, but our families are emboldened by knowing that they are on the right side of history — the only question is whether all this country’s institutions can be certain of the same,” said Gustavo Torres, executive director of CASA de Maryland, the immigrant organization that was the lead plaintiff in the case.

A series of lower-court judges ruled against the administration, finding that Trump’s decision to end the program was based on faulty legal reasoning. Those decisions allowed immigrants already enrolled to renew their participation — meaning DACA remained in place. The program has shielded nearly 700,000 young people, often referred to as “dreamers.”

The ruling from the Richmond-based 4th Circuit partly reverses a decision from the late U.S. District Judge Roger W. Titus of Maryland, who last year said — in a ruling that broke with the views from lower courts — that the administration had the authority to wind down the program.

Trump cited that decision in his favor in a message at the time on Twitter: “Federal Judge in Maryland has just ruled that ‘President Trump has the right to end DACA,’ ” Trump wrote.

In his decision, Titus, who was appointed to the federal bench in Maryland by President George W. Bush and died in March, criticized Trump for his “unfortunate and often inflammatory rhetoric,” and noted that, were he not a judge constrained to interpreting the law, he would opt for a different result.

“An overwhelming percentage of Americans support protections for ‘Dreamers,’ yet it is not the province of the judiciary to provide legislative or executive actions when those entrusted with those responsibilities fail to act,” Titus wrote, adding later, “This Court does not like the outcome of this case, but is constrained by its constitutionally limited role to the result that it has reached. Hopefully, the Congress and the President will finally get their job done.”

Justin Jouvenal contributed to this report.