The High Court has ruled non-citizens detained in detention unlawfully can sue the government for compensation.