The ruling and order are the latest developments in a long-running lawsuit spearheaded by Republican-led states.