A day after a federal judge denounced the former Trump adviser Michael Flynn, at a sentencing hearing, for lying to F.B.I. agents, the judge had a similar message on Wednesday for former Attorney General Jeff Sessions: Follow the law. It was one of two court decisions this week making clear that the Trump administration was overstepping its powers to restrict the granting of asylum.

While still in office, Mr. Sessions decided in June to bar immigrants from seeking asylum based on their fears of domestic violence and gangs, basically putting them on a fast track for deportation back to the dangers they had fled. Mr. Sessions had said that “the mere fact that a country may have problems effectively policing certain crimes” shouldn’t be grounds for asylum.

In his ruling on Wednesday, the judge, Emmet Sullivan of the Federal District Court in Washington, all but accused Mr. Sessions of taking the law into his own hands . By creating a system that categorically denied these claims, the judge wrote, “the attorney general has failed to stay within the bounds of his statutory authority.”

Federal law grants newly arrived migrants what is known as a “credible-fear screening” — an interview with an officer who determines whether the migrant has a credible fear of persecution in his or her native country. That is typically not a high bar to meet, and once a migrant clears it, he or she may remain in the United States as the asylum process continues.