Superior Court Judge Scott Gordon heard arguments in the four-decade-old case but gave no immediate indication of how he would rule, saying he would issue a written order.
Polanski's lawyer, Harland Braun, said he was trying to find a solution for a unique case, while a prosecutor said the Oscar winner was trying to get special treatment and dictate how the case proceeds from afar.
Deputy District Attorney Michele Hanisee said Polanski needed to appear in court to resolve the charges and urged the judge to reject what she called an attempt to give a "wealthy celebrity different treatment than any other fugitive."
The hearing was the first time in seven years that a Los Angeles judge has considered Polanski's case, which dates to 1977. He was accused of plying a 13-year-old girl with champagne and part of a sedative pill, then raping her at actor Jack Nicholson's house.
Polanski pleaded guilty to unlawful sex with a minor but fled Los Angeles on the eve of sentencing in 1978. Since then, his movements have been restricted to France, Poland and Switzerland.
The victim has said she forgives the "Rosemary's Baby" director and believes the case should end.
Polanski, 83, has long contended that he is the victim of judicial misconduct because a now-deceased judge who handled the case suggested in private remarks that he would renege on a plea bargain and sentencing agreement. It called for no more time behind bars for the director after he spent 42 days in a prison undergoing a diagnostic screening.
Braun says Polanski has already served his sentence, in a part due to 335 days he spent in jail and under house arrest during a failed extradition effort from Switzerland in 2010.
The defense attorney pointed to statements by the original lawyers on the case saying the deceased judge had gone back on the sentence he initially promised the director. Braun said he was trying to get an assurance that the original agreement would be honored, either from the judge or prosecutors.
Hanisee refused, and Gordon did not indicate how he would respond. The judge directed several pointed questions about the facts and evidence to Braun during the hearing, and the prosecutor said she thought Braun's calculations about how much time Polanski has served were incorrect.
Braun tried several strategies before and during the hearing but ultimately abandoned an effort to unseal 2010 testimony from the original prosecutor. He said the various approaches aimed to get enough of an assurance for Polanski to return to the United States, hopefully without the need to arrest the director.
"This is a unique case, and I'm trying to fashion a unique solution to resolve the case," Braun said.
Hanisee blamed Polanski for its strange procedural history.
"This case is 40 years old because the defendant fled," she said.
Braun has given a lengthy recitation of allegations of past judicial misconduct in his court filings but said Monday he did not want to litigate those issues.
"You've ventured very far into those things you don't want to get into," Gordon told Braun, smiling.
The judge said that if Polanski wanted to address those allegations in court, it would seem that he would need to personally appear.
Polanski won an Academy Award for best director for his 2002 film "The Pianist" and was nominated for 1974's "Chinatown" and 1979's "Tess."
This story corrects Roman Polanski's flight from the U.S. to 1978.
Anthony McCartney can be reached at http://twitter.com/mccartneyAP .
Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.