The Supreme Court ruled Monday that an independent commission created by Arizona voters to draw congressional and state legislative districts is constitutional. If the court had struck down AZ’s commission, it would have made it much harder for states to find ways to stop partisan lawmakers from drawing districts in a way that benefits their party.

By 5-4, the justices ruled that the Constitution does not necessarily bar states from cutting their legislatures out of the redistricting process. Justice Ruth Bader Ginsburg wrote the majority opinion and was joined by Justices Kennedy, Breyer, Kagan and Sotomayor. Chief Justice Roberts, as well as Justices Scalia, Thomas, and Alito dissented.

RELATED: A new bid to strengthen the Voting Rights Act

“The people of Arizona turned to the initiative to curb the practice of gerrymandering and, thereby, to ensure that Members of Congress would have ‘an habitual recollection of their dependence on the people,’” Ginsburg wrote. “In so acting, Arizona voters sought to restore ‘the core principle of republican government, ‘namely, ‘that the voters should choose their representatives, not the other way around.’”

The decision in Arizona State Legislature v. Arizona Independent Redistricting Commission likely upholds not just Arizona’s redistricting commission, but also California’s. Both were approved by voters and are independent of the legislature. Had Arizona’s commission been struck down, it likely would have meant both states’ congressional districts — 62 in all — would have had to be redrawn by lawmakers.

“I am pleased that the Supreme Court has vindicated the rights of voters who want their electoral districts drawn fairly, independently and without undue emphasis on partisan affiliation or political creed,” Attorney General Loretta Lynch said in a statement. “Arizona’s approach to redistricting is an innovative and effective advance in the effort to reduce gerrymandering and give all Americans an opportunity to make their voices heard. Today’s decision is a victory for the people of Arizona, for the promise of fair and competitive elections and for the principles of democratic self-governance that make our nation exceptional.”

Arizona’s commission originated after the state’s voters approved a ballot initiative in 2000 that amended the state’s constitution to create an independent, non-partisan five-member body to handle redistricting. Four of the commission members were to be chosen by legislative leaders, but only from a list drawn up by another state agency. The fifth member, who would be chair, would be chosen from the same list by the four existing members.

The Republican-controlled state legislature sued in 2012, arguing that the Constitution’s Elections Clause requires that the legislature be in charge of the redistricting process.

Recent years have underscored how having partisan lawmakers control the redistricting process can allow gerrymandering to a degree that threatens the democratic legitimacy of our political system. After the 2010 Census, Republicans drew congressional districts to their party’s advantage in several big states that they controlled, including Texas, Pennsylvania, Ohio, Michigan, Virginia, North Carolina, and Florida. As a result, though Democrats won an estimated 1.37 million more votes than Republicans in the 2012 congressional races, they came away with just 46% of House seats. Democrats also have used the redistricting process to their advantage, most notably in California.