The first legal setback to the Trump administration's hardline immigration policies has been imposed by a judge who has blocked a ban on birthright citizenship.