Court says policy requiring migrants to seek asylum in other countries before US can hold while legal challenge continues