Every 10 years, after the census is complete, legislators in statehouses across the country embark on a time-honored tradition: remapping the boundaries of their states’ voting districts, usually to the benefit of the people doing the remapping. Gerrymandering, the practice of painstakingly engineering districts to bestow an advantage on the politicians in control of the process, has been baked into the American political process since the 18th century — and legal challenges to the weird-looking maps that result have their own long history, too.

But not all gerrymanders are created equal, at least from a legal perspective. On Monday, the Supreme Court will hear arguments in two gerrymandering cases, in which the plaintiffs claim that after the 2010 census, Republican legislators in North Carolina and both parties in Virginia deliberately packed black voters into a small number of congressional and state legislative districts. The plaintiffs in the two cases, McCrory v. Harris (North Carolina) and Bethune-Hill v. Virginia State Board of Elections (Virginia), claim that by concentrating black voters in a few districts in an effort to protect their majorities, legislators unfairly diluted black voters’ influence. The legislators, on the other hand, say they are merely complying with the Voting Rights Act, which requires states to create districts where minority voters can select their preferred candidate. The question at the heart of these cases is a political riddle: How much mandated racial gerrymandering is too much racial gerrymandering?

In 2011, Republican legislators in North Carolina increased the percentage of black voters in the two congressional districts designed to comply with the Voting Rights Act to just above 50 percent. Both parties in Virginia increased the percentage of black voters needed for 12 state legislative districts to at least 55 percent. Nicholas Stephanopoulos, an assistant professor at the University of Chicago Law School, says that from a legal perspective, North Carolina and Virginia made a mistake when they created mechanical quotas for these districts. “The states are saying, ‘The Voting Rights Act made us do it,’ but the Supreme Court has said in the past that these kinds of crude mechanisms aren’t required,” he said. But in its decision, the Supreme Court could help state legislators struggling to draw lines that comply with the Voting Rights Act without running afoul of the Constitution.

“It’s very hard to come up with a magic number that satisfies the statute and the Constitution,” said Nathaniel Persily, an election law expert and professor at Stanford Law School. The Supreme Court has ruled that in geographically compact places with large minority populations and high levels of racial polarization in voting, legislators must draw districts that ensure these groups are able to elect candidates to represent their interests. But districts that are drawn only with race in mind can also violate the 14th Amendment’s equal protection clause.

Courts have been wrangling with the states for years about the appropriate ways to draw these boundaries. Partisan gerrymandering has largely been ruled acceptable, with the notable exception of a federal court ruling in Wisconsin in November. That’s left racial gerrymandering as the battleground.

The political ramifications of these two racial gerrymandering cases could be significant, because when it comes to voting rights, race and politics are hopelessly intertwined. The Voting Rights Act was designed to stamp out a practice, common in the South at the time, of spreading black voters too thinly among districts, where their votes would be overwhelmed by the white majority. But critics allege that Republican legislators, after sweeping statehouses across the South in 2010, are perverting the intention of the Voting Rights Act to suit their political ends.

There’s a reason, Stephanopoulos says, why the cases are being led by Democratic Party lawyer Marc Elias. Just as in the 1990s, Republicans fought back against Democrats’ efforts to create more minority-controlled districts, the Democrats are now using the racial gerrymandering claim to try to stop Republicans from compressing black voters — who reliably vote Democratic — into a small number of districts, a move that could lead to fewer minority legislators.

Partisan battles aside, political scientists say that in order for the government to pay attention to minority communities, those districts need representatives who are accountable to them. Christian Grose, an associate professor of political science at the University of Southern California, studied congressional districts in the South and found that black legislators were likelier than white legislators — regardless of party — to allocate federal funding to historically black universities and heavily black communities. Another political scientist, Bernard Fraga, found that voter turnout was higher in more heavily minority districts, which also meant more minority elected officials. According to another unpublished analysis, the overwhelming majority of minority legislators are elected from majority-minority districts; in 2015, 95 percent of all African-American state house representatives in the South were elected from majority-minority districts.

The catch is that to ensure legislators bring benefits to their communities, it’s not enough simply to elect more of the politicians minorities prefer — Fraga said the elections also need to be competitive. In a district that is 60 percent African-American, for example, an incumbent might reliably sail to victory each election season, without needing to work for her constituency’s votes.

Political scientists say that there are ways to evaluate whether a district packed with a majority of minority voters is really necessary under the Voting Rights Act — states just need to be willing to use them. David Lublin, a political science professor at American University, says that legislators should draw on sophisticated methods to help estimate the share of minority voters needed to elect their preferred candidate — which will inevitably vary according to the local context. (The local context can also change in any election, which is one limitation of these methods.) In states such as Virginia, where 37 percent of white voters cast a ballot for Barack Obama in 2012, the need for majority-minority districts may not be as great, because enough white liberal voters might be willing to vote for the candidate who minority voters also prefer. In Mississippi, on the other hand, where only 10 percent of whites voted for Obama in 2012, a solid majority of black voters could be very necessary to get a minority-preferred candidate elected.

Other redistricting experts are urging the court to cast a skeptical eye not just on the data, but on the political context. North Carolina’s legislators are defending their actions in one of the two contested congressional districts by claiming that they were packing black voters because of their party affiliation, not their race. In an amicus brief, attorneys for NYU’s Brennan Center for Justice argued that the state’s political climate in the aftermath of the 2010 election undercuts this claim. “The legislature was cutting back early voting and doing other things that specifically disadvantaged African-Americans, which suggests that there was a real racial motivation in creating this district,” said Michael Li, senior counsel for the Brennan Center.

If the Supreme Court rules against North Carolina or Virginia, the consequences would likely favor the Democrats. Last week, in another case, a federal district court ordered special elections for 28 additional North Carolina House and Senate districts using new legislative maps, saying that the original districts were unconstitutional racial gerrymanders. When the ruling comes down sometime next year, the effect in these Supreme Court cases wouldn’t necessarily be immediate: Virginia’s map might not be redrawn in time for the next wave of state elections, in 2017. But advocates of more sweeping reform hope that cases like these will make the courts rethink whether it’s a good idea to allow incumbents of either party to maintain control of redistricting, or whether that task should go to people whose jobs don’t depend on the outcome.