The judge found the actions of Immigration and Customs Enforcement and another government arm "arbitrary and capricious."