WASHINGTON — The Supreme Court agreed on Friday to decide whether states can take account of a judge’s political affiliation in trying to achieve ideological balance on their courts.

The case, Carney v. Adams, No. 19-309, concerns a provision of Delaware’s Constitution that says judges affiliated with any one political party can make up no more than a “bare majority” on the state’s highest courts, with the remaining seats reserved for judges affiliated with the “other major political party.”

James R. Adams, a registered independent, sued to challenge the provision, saying it violated the First Amendment. A federal appeals court agreed.

In a petition asking the Supreme Court to hear the case and uphold the provision, Gov. John C. Carney Jr. wrote that the state’s approach to judicial selection, which also requires judges to be nominated by the governor and confirmed by the State Senate, was constitutional and had produced courts with an exemplary reputation.