Maryland Democratic leaders set out in 2011 to redraw the state’s congressional districts to boost the likelihood that the party’s 6-to-2 edge in the delegation became 7 to 1, the state’s Democratic former governor Martin O’Malley recalled last year. It was nothing personal.

“I came to really like and respect and in many ways admire” the Democrats’ unlucky target, Republican Roscoe G. Bartlett, who had represented Maryland’s 6th Congressional District since 1993, O’Malley said.

But business is business, and this business was politics.

Hundreds of thousands of voters were shifted, Republicans became a distinct minority in the 6th District, and Bartlett, who had been reelected in 2010 by a 28-percentage-point margin, lost to a Democrat in 2012 by 21 points.

“As the elected governor, I did my duty within the metes and bounds” of Maryland law that set up redistricting as a partisan exercise, O’Malley said last spring in a deposition. He added that if the reconfigured district “would be more likely to elect a Democrat than a Republican, yes, this was clearly my intent.”

O’Malley’s frank admission is at the heart of what is becoming an unprecedented look at partisan gerrymandering by the Supreme Court. The justices on Wednesday will hear the challenge to Maryland’s Democratic decision-making, after last fall examining — but not yet deciding — a lawsuit on Republican efforts in Wisconsin.

The cases hold the prospect that the court is on the brink of a historic change in the way elections are conducted in the United States.

If O’Malley’s words sound like a confession, claiming partisan gerrymandering for years has actually been a defense. The justices regularly police state legislators who overly rely on voters’ race when drawing electoral districts, but the court has never thrown out a state’s map because it was drawn to help one political party over another.

Some justices have considered that a perk of power that the courts have no role in overseeing.

But the political landscape has changed, and the legal one might as well.

“There’s a revolution underway,” said Kathay Feng, national redistricting director for Common Cause.

Voters across the country are organizing to take redistricting power away from politicians and put it in the hands of nonpartisan decision-makers — although many states, including Maryland, don’t allow such changes without legislative approval.

The other option is litigation, and courts in Wisconsin, North Carolina and Pennsylvania have thrown out maps where the partisan line-drawing was judged extreme.

In Pennsylvania’s case, the state Supreme Court ordered a new map for this fall’s election that levels the playing field for congressional candidates. The old map drawn by the state’s Republicans provided such an edge that the party consistently won 13 of the state’s 18 districts, despite its reputation as a battleground state in national elections.

The U.S. Supreme Court turned down pleas from Republican lawmakers to get involved, letting the new maps go into effect.

The justices’ decision to take the Maryland case, which raises different constitutional challenges than the one from Wisconsin, heartened those who are advocating for change.

“It’s clear that the Supreme Court wants to say something about partisan gerrymandering, and we don’t quite know what that is yet,” said Michael Li, senior counsel for the Brennan Center for Justice’s Democracy Program. But he said that if the court had decided it had no role in policing partisan gerrymanders, as some states have suggested, the court did not need to take a second case to say that.

Maryland’s governor, Larry Hogan (R), took the unusual step of filing an amicus brief on behalf of the challengers and against his state. He has tried since his inauguration to persuade legislators to turn redistricting over to a nonpartisan commission. He said the judicial interest in the issue coincides with a new public awareness.

“Polling on this is off the charts,” Hogan said in an interview, adding, “Democrats, Republicans, independents — everyone thinks that citizens should be able to pick their representatives, rather than have it the other way around, where representatives get to pick their voters.”

Indeed O’Malley — who was adamant during the deposition that Maryland’s map met constitutional requirements for one person, one vote and respected the Voting Rights Act’s protection of racial minorities — said he thinks the system should be scrapped.

“Some states are starting to move to nonpartisan redistricting commissions, and I think that would be a positive and healthy and good thing for our nation,” he said.

Maryland’s case provides a bit of counterprogramming to the national image of partisan gerrymandering as a Republican sport.

The party simply has more chances to show its stuff: The 2010 election put Republicans in sole control of the redistricting in 21 states following the ­once-a-decade census.

They produced maps that critics said solidified GOP control of state legislatures, such as in Wisconsin, and produced congressional districts in battleground states such as North Carolina that meant Republicans captured 10 of 13 seats.

Maryland was an exception, one of 11 states after the 2010 election with Democrats in control of the legislature and governor’s mansion.

In such an arms race, there was pressure on Democrats to do what they could to alter the national picture, Democrats have said.

The obvious targets were Bartlett and Rep. Andy Harris, a Republican who represented the Eastern Shore. As O’Malley put it in his deposition, “the largest estuary in North America” — the Chesapeake Bay — made changes to Harris’s district unwieldy.

Easier was to put many of the Republicans in the old 6th District into the overwhelmingly Democratic 8th District. And to add Democrats from Montgomery County into the 6th.

When completed, the 6th District stretched from the state’s westernmost border across the panhandle before taking a sharp turn into Montgomery County, all the way down to about 10 miles from the White House. The 8th started in Takoma Park, on the border of the District of Columbia, and ran to the Pennsylvania border.

Both were won by Democrats.

Michael B. Kimberly, a Washington lawyer representing Republican voters, has tailored his challenge to appeal to Justice Anthony M. Kennedy, seen as the court’s pivotal member on the issue. Kennedy in the past has wondered whether partisan gerrymandering should be seen as retaliation against voters based on their political affiliations.

Kimberly’s brief offers just that: “What happened in Maryland’s Sixth District in 2011 — and what is sure to happen all over the nation in 2021 absent this court’s intervention — is a clear violation of the First Amendment, which forbids states from disfavoring citizens on the basis of their political views.”

Whether Maryland lawmakers set out only to make sure a Democrat was elected, instead of retaliating against voters who had elected Bartlett in the past, does not change the legal analysis, Kimberly said.

Brian E. Frosh, who as a Democratic state senator chaired the redistricting committee and now defends the state as attorney general, did not respond to an interview request.

In his brief to the court, he says the state’s action was a defensible way to deal with the state’s growth, much of which occurred in the areas at issue. It produced a district that is competitive, he said. Rep. John Delaney (D), who defeated Bartlett in 2012, almost lost to a different Republican challenger in 2014.

And Frosh said the challengers failed to provide the court with the thing that has vexed past judicial efforts to impose standards on partisan gerrymandering: a way to “determine when partisan considerations in the redistricting process have gone too far.”

“By dodging the problem, the plaintiffs’ proposed standard threatens to render any partisan motive fatal to redistricting — something that this court has already rejected,” the state’s brief said.

The case is Benisek v. Lamone.