Government suffers legal aid setback after High Court declares ‘residency test’ unlawful