The Maryland Statehouse in Annapolis. (Mark Gail/The Washington Post)

A panel of federal judges on Friday sided with Republicans challenging Maryland’s electoral map, saying there is convincing evidence that the state’s Democratic leaders intentionally drew voting boundaries to make it easier for their party to pick up another congressional seat.

One judge described the politically motivated mapmaking as “nefarious activity.”

But the three-judge panel was divided about whether the contours of the 2011 redistricting plan were the direct cause of longtime GOP Rep. Roscoe G. Bartlett’s loss in 2012, and whether officials should literally have to go back to the drawing board before next year’s election.

The judges at the U.S. District Court in Baltimore were considering a request for an immediate injunction that would scrap the electoral map at least for one congressional district, which lies mostly in Western Maryland but includes parts of Montgomery County. The hearing centered on the motivations of the state’s Democratic establishment when it redrew boundaries in 2011.

Inside the wood-paneled courtroom, lawyers displayed photos and videotaped depositions of top Democratic officials, including Senate President Thomas V. “Mike” Miller Jr., House Speaker Michael E. Busch and former governor Martin O’Malley.

Then-Gov. Martin O'Malley (D), center, in the Maryland State House with Senate President Thomas V. Mike Miller (D), left, and House Speaker Michael Busch (D) in 2013. (Patrick Semansky/Associated Press)

The half-day session in Baltimore also reflected growing concern nationwide about gerrymandering, which is the subject of a Wisconsin case that is headed to the Supreme Court in the fall term, and which U.S. District Judge James K. Bredar on Friday called a “cancer on our democracy.”

Looming over the hearing was a question of timing and how the Supreme Court’s decision to take the Wisconsin case will affect the challenge in Maryland, which also seems destined for the high court.

The Supreme Court has thrown out state voting maps drawn to weaken the influence of racial minorities, but it has have never settled on a test to measure whether a plan is unconstitutional because of partisan gerrymandering.

In the Maryland case, challengers are Republican voters who say they were punished because of their party affiliation and voting record when the Democratically controlled state government intentionally diluted the strength of GOP voters in the 6th District.

For two decades, the district was represented by Bartlett. After the lines were redrawn to include more residents from heavily Democratic Montgomery, John Delaney (D) was elected. He still holds the seat.

The office of Attorney General Brian E. Frosh (D), which is defending the plan, said state officials wanted to create a more competitive district, but that the election outcome was far from guaranteed.

Assistant Attorney General Sarah Rice told the judges that forcing the state to redraw its electoral map now, less than a year before the 2018 primary, would be “extraordinary.” It would require a special session of the General Assembly, creating confusion for voters and forcing current candidates to “campaign under a cloud” of uncertainty. Her office wants to delay the lawsuit until after the Supreme Court rules in the Wisconsin case.

Even as all three judges accepted what they called substantial and overwhelming evidence of partisan gerrymandering, two of the three seemed deeply skeptical that there were not other factors at work in Bartlett’s defeat. They also questioned the reliability of the measurements political consultants used to shift likely Republican and Democratic voters from one district to another.

“Can you prove it? Where’s the concrete evidence that displaced voters would have voted for Bartlett?” U.S. District Judge George L. Russell pressed attorney Michael Kimberly, who represents the challengers. “You’ve got to demonstrate the results would have been different.”

Russell and Bredar noted the difficulty of predicting individual voting patterns and pointed to the surprising outcome in the 2016 presidential election, when states that had supported Democratic President Barack Obama in 2012 backed Republican Donald Trump. Closer to home, the judges noted the election of Gov. Larry Hogan (R) in 2014 in a state where registered Democrats outnumbered registered Republicans more than 2-to-1.

“It is an overwhelming case,” said Bredar who had earlier described the redistricting as “nefarious activity.” But, he said, “that still doesn’t answer the question of whether it worked.”

The third judge, Paul V. Niemeyer of the U.S. Court of Appeals for the 4th Circuit, had no problem connecting the dots. “It seems to me they were highly successful in getting exactly what they wanted,” he said of the Democrats who oversaw redistricting. “These politicians had the power to make the map the way they wanted it.”

An O’Malley spokesman declined to comment but pointed to a speech this year in which the former governor called for redistricting reform and said he believed in 2011 that he should wield his power to favor Democrats. Busch and Miller did not respond to requests for comment.

In its brief, the attorney general’s office said there were other reasons for Bartlett’s defeat. At 85, his popularity was waning and he was having trouble raising money, the court filing said. The brief also noted that Delaney came close to being unseated by a Republican challenger in 2014.

The judges did not indicate on Friday how quickly they will rule. If either side appeals the outcome, the case goes directly to the Supreme Court, which must either affirm, reverse or accept the case for oral arguments.

Robert Barnes contributed to this report.