A court overturned an injunction for the migrants to leave the hotel after the Home Office intervened.