Partisan gerrymandering — the dark art of drawing legislative district lines to specifically favor Republicans or Democrats — is as old as it is corrosive to a representative democracy. Self-interested politicians have no business making maps with the sole purpose of keeping themselves and their party in power.

And yet for decades, the Supreme Court has refused to interfere, unable to agree on a standard to determine when redistricting for partisan purposes violates the Constitution, even when it leads to grotesque results.

In contrast, because of clearer constitutional concerns, the court has weighed in repeatedly on the problem of race-based redistricting. Last week, the justices struck down two North Carolina congressional districts that unnecessarily packed in tens of thousands of extra African-American voters, drawing them out of other districts where they might have made a difference. Of course, race and partisan affiliation are hard to disentangle, as the opinion by Justice Elena Kagan admitted, especially in the South.

With a partisan gerrymandering case likely to hit the court’s docket next term, the justices should finally set clear limits on the practice. The need for those limits is growing only more urgent as voter data and computer-mapping technologies become more sophisticated, and politicians become more brazen in their efforts to protect their power.