On Friday, the North Carolina Supreme Court struck down a Republican-sponsored measure stripping Democratic Gov. Roy Cooper of his ability to regulate the state’s elections. The 4–3 decision preserves Cooper’s control of the State Board of Elections, ensuring he will be able to restore voting rights throughout North Carolina in time for the 2018 election.

Following Cooper’s election in November 2016, the GOP-dominated General Assembly passed a series of bills weakening the governorship and concentrating power in the legislature. The centerpiece of this effort was a radical overhaul of the board of elections. Previously, the board had five members, with three from the governor’s party. Under former Republican Gov. Pat McCrory, the body authorized a dramatic rollback of early voting and a reduction in polling places, particularly in minority-heavy communities. Cooper planned to reverse these policies. But before he could, the legislature restructured the board, creating a new group with eight appointees, four Democratic and four Republican. The practical effect would be near-constant gridlock.

Cooper sued, and a state court blocked the measure in March. But the legislature promptly tweaked the law and passed it again. (Due to litigation, however, the eight-person board never actually assembled.) Once again, Cooper filed suit, alleging that the overhaul violated the North Carolina constitution.

A majority of the state Supreme Court—all four of its Democratic justices—agreed with Cooper. In his opinion for the court, Justice Sam J. Ervin explained that the fundamental flaw in the act was its infringement upon the separation of powers. The North Carolina constitution contains an unusually robust separation-of-powers clause, requiring the legislative, executive, and judicial branches to be “forever separate and distinct from each other.” It also directs the governor to “take care that the laws be faithfully executed.” In a previous decision, the court ruled that these provisions preserve the governor’s control over boards within the executive branch, including the appointment of commissioners.

The new elections board, Ervin noted, plainly runs afoul of this rule. Under the law, the governor must select four Republican commissioners from a list devised by GOP legislative leaders. Yet the board is an executive branch agency over which Cooper is constitutionally empowered to exercise significant control. Ervin thus concluded that, in creating the board, the legislature had overstepped its constitutional boundaries and encroached upon the governor’s. To remedy this problem, Ervin held that the legislature must allow the governor to appoint a majority of commissioners from his own party to the state board.

Friday’s decision did not hand Cooper an absolute victory. The court declined to strike down measures that gave Republicans some administrative control over the state board and that equally divided county boards between Democrats and Republicans. Instead, the court adopted a wait-and-see approach: It held that these laws could violate separation of powers, but postponed final judgment until the state board’s configuration is brought in line with the constitution. Cooper will likely challenge these rules separately in the near future.

For now, the state Supreme Court’s ruling is a qualified success for the governor—and, much more importantly, a victory for North Carolina voters. Once Democrats take control, the new elections board can repeal McCrory’s disenfranchisement policies and protect access to the ballot for all North Carolinians. The state won’t have truly fair elections until the legislature is forced to redraw its politically and racially gerrymandered districts. But Friday’s ruling is an important step forward in the state’s fight for the franchise.