Judge’s ruling protects migrant shelter on US-Mexico border and accuses Texas of harassment