The ruling reinforces controversial laws enacted last year that limit eligibility through distant ancestry.