The ruling comes as Trump seeks to use National Guard troops in order to crack down on crime in other US cities.