WARSAW — The Polish Supreme Court on Tuesday rejected a government request to extradite Roman Polanski, the Oscar-winning filmmaker, to the United States over a decades-old conviction for having sex with a 13-year-old girl.
The decision almost certainly ends the legal battle in Poland over how to deal with Mr. Polanski, although as a practical matter, even a ruling in favor of the government would have had little effect. Mr. Polanski, a dual citizen of France and Poland, lives in France, which does not extradite its citizens.
Judge Michal Laskowski ruled that a lower court’s verdict was not a “flagrant violation of the law,” as the request for an appeal had claimed. “The regional court of Krakow considered and verified all evidence exceptionally carefully,” Judge Laskowski said.
The legal effort reflects a broader push by the conservative Law and Justice government, which since coming to power a year ago has been calling for a return to Roman Catholic values in Poland, to try to reinforce its reputation as a law-and-order party.
The ruling on Tuesday came six months after the chief prosecutor and justice minister, Zbigniew Ziobro, asked the court to overrule the earlier verdict as the government sought to extradite Mr. Polanski, whom authorities in the United States have wanted for decades.
A spokesman for the Ministry of Justice said that Mr. Ziobro “accepts and respects” the Supreme Court’s decision, although he still “takes the position that proceedings concerning sexual abuse of minors should be enforced consistently” regardless of who committed the crime, or when it occurred.
Mr. Polanski was arrested in 1977 on charges that included the rape of the teenager at the Los Angeles home of Jack Nicholson, the actor. In 1978, Mr. Polanski left the United States on the eve of sentencing under an agreement by which he was to plead guilty to a count of statutory rape.
In October 2015, a judge in Krakow, Poland, ruled that turning over Mr. Polanski would be an “obviously unlawful” deprivation of liberty, saying that the State of California, where he was convicted, was unlikely to conduct a fair trial and provide humane conditions of confinement for the director, who was 82 at the time.
The Krakow prosecutor’s office, which had sought Mr. Polanski’s extradition on behalf of Los Angeles County, said a month later that it would abide by the judge’s ruling.
But Mr. Ziobro appealed the decision to the Supreme Court at the end of May, calling the trial judge’s ruling “incomprehensible” and a “serious breach” of the extradition agreement between Poland and the United States.
Mr. Ziobro said in an interview with Polish state radio in May that Mr. Polanski had received preferential treatment because of his fame.
“If he was just a regular guy, a teacher, doctor, plumber, decorator, then I’m confident that he’d have been deported from any country to the U.S. a long time ago,” he said.
In his opening statement on Tuesday, Jan Olszewski, a lawyer for Mr. Polanski, recalled how the Swiss authorities had declined in 2010 to extradite Mr. Polanski, who directed “Chinatown,” because of doubts over the conduct of the judge in his original trial.
Jerzy Stachowicz, another lawyer for Mr. Polanski, argued in court that his client had not technically fled the United States because he had never been prohibited from leaving.
“Mr. Polanski didn’t flee, as it is believed,” Mr. Stachowicz said. “He simply bought a plane ticket, checked in his luggage and boarded a plane. It was not fleeing.”
Referring to Mr. Ziobro’s argument, Mr. Stachowicz said, “If Mr. Polanski were not a celebrity, a famous filmmaker, but he was an average Joe, this case would have been over long ago, and nobody would have ever heard of it.”
The Supreme Court ruling means that Mr. Polanski, now 83, would be free to work in Poland. He has been planning to make a film about Alfred Dreyfus, a French Jew who was wrongly accused of spying and whose case raised a debate in the late 19th century about prosecutorial misconduct.
The film, “An Officer and a Spy,” was to be shot in Poland, but it was announced in June that Mr. Polanski had decided to make it in France.
That prompted speculation that his legal problems had led him to move production of the film, but Robert Benmussa, the film’s producer, attributed the decision to French tax incentives, according to The Los Angeles Times.
Mr. Polanski, who lives with his wife in France, was not in court on Tuesday.
“This is just too emotional for him,” Mr. Stachowicz said by telephone on Monday, before the ruling. “This has been going on for such a long time. A ruling against overruling the first verdict would be a great relief for him.”
After the ruling, Mr. Olszewski, the lawyer, said that he had spoken with Mr. Polanski on the phone. “He is currently in France, where he is shooting his new film,” Mr. Olszewski said. “He is beyond happy that this is finally over. At least in Poland.”
An article on Wednesday about the Polish Supreme Court’s rejection of a request by the government to extradite Roman Polanski to the United States referred incorrectly to a film project of Mr. Polanski’s about the Dreyfus Affair. The film is not yet in production, thus Mr. Polanski is not currently directing it. And the title is “An Officer and a Spy,” not “The Dreyfus Affair.”