The suit was filed and argued by the American Civil Liberties Union.

Representative Marcy Kaptur, a Democrat from Toledo, testified at the two-week trial that her district, which winds along the shore of Lake Erie all the way to Cleveland and is derisively nicknamed “The Snake on the Lake,’’ was the epitome of extreme gerrymandering. The trial revealed that Republican mapmakers operated out of a hotel room they called “the bunker,’’ and in one email, a national consultant referred to downtown Columbus, which is heavily Democratic, as “dog meat” territory.

Republicans’ representatives argued at trial that the maps were drawn to protect incumbents of both parties and that there was nothing illegal in doing so.

The three judges, two of whom were appointed by Democratic presidents and one by a Republican president, disagreed.

“We conclude that the 2012 map dilutes the votes of Democratic voters by packing and cracking them into districts that are so skewed toward one party that the electoral outcome is predetermined,” the judges wrote in their 301-page decision.

In the cases now before the Supreme Court, a central issue is whether courts can draw a bright line between acceptable political maps and ones whose partisan aims overstep constitutional bounds, a question the justices have struggled with for decades. Chief Justice John Roberts has openly worried that the court could be perceived as acting in a partisan way if it intervenes in such inherently political decisions.

But after a series of lower courts have thrown out partisan maps, “it’s becoming harder and harder for the Supreme Court to claim that there’s no possible way for courts to manage claims like these,” said Justin Levitt, the associate dean of Loyola Law School in Los Angeles. “It shows that courts can and do manage these cases just fine, with reasonable opinions that don’t look simply like the judges are wearing partisan hats.”

In Pennsylvania, a State Supreme Court ruling last year led to new, less partisan districts that in midterm elections helped Democrats net three Republican-held seats in the House of Representatives. The United States Supreme Court let the state court decision stand.