Bill Cosby's sexual assault trial this spring will stay in Norristown, but will be decided by jurors from outside Montgomery County, a judge ruled Monday, citing pervasive local media coverage of the case.

Judge Steven T. O'Neill said he remained optimistic that moving jury selection would not delay the scheduled June 5 trial date. Delivering his order from the bench, he added that he intended to sequester the panel for the trial once it is selected.

"No matter where we go, I have a feeling that [the media] will follow," he said.

Deciding just where those jurors will come from now falls to the Pennsylvania Supreme Court. Typically, the court looks for counties similar in size to the original location of the prosecution, though there is no legal requirement to do so.

Supreme Court staff members will begin looking for a county similar to  but not bordering Montgomery County as soon as they receive the judge's order, said Art Heinz, a spokesman for the court. Cosby's trial will mark the second time since 2006 that a Montgomery County case has had a jury from a different county.

Cosby's lawyers had pushed during a brief hearing Monday to draw the panel from an urban center of at least 1.2 million people, which would have limited the choices to Philadelphia and Allegheny Counties. O'Neill, however, appeared skeptical that the state's court administrators had an obligation to consider their input in making the decision. Heinz said Monday that input from lawyers involved in the case is "not something that's typically done."

Prosecutors did not oppose the idea of bringing in an outside jury, but they pushed back against Cosby's additional request to move the trial from Norristown, a move defense attorney Brian J. McMonagle called "the best of the worst alternatives."

He railed against the voracious media coverage of the case, accusing reporters and pundits of declaring themselves "judge, jury, and executioner of Mr. Cosby's reputation," and saying it was impossible for his client to receive a fair trial anywhere in the country. But McMonagle said he held out hope that a county with an almost inexhaustible supply of potential jurors might help in selecting an impartial panel.

"No matter where we go … the national media has affected the entire state of Pennsylvania," he said. "Unless you've been living under a rock in this state or in this country day after day for the last few years, the message that has been promoted is that Bill Cosby is guilty and that Bill Cosby is a serial rapist."

District Attorney Kevin R. Steele, whom McMonagle had accused of contributing to the problem by running a series of campaign ads featuring the Cosby case while running for his job in 2015, declined to comment after the hearing.

But in arguments before the court, one of his assistant prosecutors, Stewart Ryan, balked at what he described as the defense's "excoriation of the media … in an attempt to lay the faults of [Cosby] at their feet."

Dressed in a light brown blazer, Cosby sat quietly at the defense table during the hearing. Before it began, he stumbled as he was guided into his chair. His lawyers have said he is legally blind.

Selecting out-of-county juries is "uncommon but not rare," Heinz said Monday.

There is no deadline for selecting a county, he said. The next step is for the Supreme Court to sign an order appointing an out-of-county jury based on a recommendation from the state court system's administrative office.

"The process in the past is always to look for some county that would be similar demographically," he said.

The judge and lawyers will then travel to the selected county to choose a jury, and then have it transported to Norristown for the trial. Montgomery County will bear the cost, Heinz said.

Since 2006, the Supreme Court has selected counties for outside juries in 19 cases, according to the court's administrative office.

Next month, jury selection is set to begin in Chester County for the Pike County murder case against Eric Frein, accused of killing one state trooper and wounding in a 2014 shooting, and hiding in the woods during a 48-day manhunt in the Poconos.

In the Frein case, the Supreme Court issued an order about a month after a Pike County judge granted a motion to bring in an outside jury.

Monday's hearing follows a pretrial victory on Friday for Cosby: O'Neill's ruling to bar prosecutors from calling all but one of the 13 female accusers they had hoped to put on the witness stand to bolster their portrait of the entertainer as a serial sexual predator.

Before that order, most of the case's disputes had swung in favor of prosecutors, including O'Neill's decision last year to allow them to present at trial Cosby's own damaging, decade-old deposition testimony in which he acknowledged offering drugs to women he wanted to seduce.

Cosby is charged with aggravated indecent assault, accused of drugging and molesting Andrea Constand at his Cheltenham home in 2004.