WASHINGTON — President Trump’s purge of the nation’s top homeland security officials is a sign that he is preparing to unleash an even fiercer assault on immigration, including a possible return of his controversial decision last summer to separate migrant children from their parents, current and former administration officials said Monday.

Mr. Trump shook up the ranks of his top immigration officials after spending months demanding that they take tougher action to stop the surge in migrant families at the border and seething about what he considers their overly legalistic refusals to do what he has said was necessary.

That anger was underscored on Monday when a judge blocked Mr. Trump’s efforts to force asylum seekers to wait in Mexico while their cases proceed — a practice that immigration advocates called inhumane and illegal. Judge Richard Seeborg of the United States District Court for the Northern District of California ruled that existing law did not give Mr. Trump the power to enforce the policy, known as “migrant protection protocols.”

The immediate targets of the president’s growing fury about the situation at the border were the officials who he saw as insufficiently steely minded: Kirstjen Nielsen, who resigned Sunday as the secretary of homeland security, and Ron Vitiello, whose nomination to permanently lead Immigration and Customs Enforcement was pulled after Mr. Trump remarked that “we want to go in a tougher direction.”