A Polish court on Friday quashed a US bid to extradite Oscar-winning director Roman Polanski, who pleaded guilty in 1977 to raping a 13-year-old girl but left the country before sentencing.
The court ruled "inadmissibility in extraditing Polish-French citizen Roman Polanski to the US," presiding judge Dariusz Mazur said at the court in the southern city of Krakow.
In a two-and-a-half-hour ruling, Mazur criticised the original US investigation, saying the judges and prosecutors there "seriously broke the rules of a fair trial".
"Had Poland accepted the US extradition request, it would have violated the rights of Mr. Polanski and at the same time the European Convention on Human Rights," the judge decided.
The decision in favour of the 82-year-old director of "The Pianist", "Chinatown" and "Rosemary's Baby" can still be appealed, court spokeswoman Beata Gorszczyk said earlier Friday.
"The case would then be sent to a higher court, which could uphold the regional court's decision, overturn it or send it back for retrial," she told AFP.
Polanski was in Krakow but did not attend the open court hearing "because of emotional reasons", his lawyer Jan Olszewski said earlier.
Local media reported that Polanski -- who has been married to French actress Emmanuelle Seigner since 1989 -- had been waiting for the verdict from aboard a plane at Krakow airport.
If the Polish prosecutor's office, which is representing the US side, decides to appeal and the extradition is ultimately cleared at the court level, then Poland's justice ministry would still have the final say.
A former justice minister and close ally of Jaroslaw Kaczynski, the leader of the conservative Law and Justice (PiS) party that won Sunday's general election, said he backed extraditing Polanski.
"Paedophilia is an evil that must be pursued," said Zbigniew Ziobro, justice minister in the 2005-2007 PiS government.
"We should allow Polanski's extradition. We can't shield anyone from taking responsibility for an act as despicable as abusing a minor."
Kaczynski himself said earlier this month that he "rejected the idea of pardoning someone simply because he is an eminent, world-renowned director."
- 'In the shadow of Polanski' -
The Polish court has been involved in the case since the US attempted to have Polanski arrested when he was in Warsaw for the opening of a Jewish museum in October 2014.
The US then filed the extradition request in January.
Polanski faces sentencing there for raping Samantha Geimer after a photo shoot in Los Angeles when he was 43.
He pleaded guilty at the time to unlawful sex with a minor, or statutory rape, avoiding a trial, but then fled the country fearing a hefty sentence. He now lives in France.
Polanski had said he doubted the extradition application would be granted but said he would comply with the legal proceedings.
He testified for a marathon nine hours at the first closed-door extradition hearing in February.
Polanski, who became a French citizen in 1976 after moving to France from Poland, is currently working on a new film about France's Dreyfus Affair.
The case featured an army captain wrongly convicted in 1894 of espionage and treason whose ordeal became a symbol of injustice and anti-Semitism.
Polanski is himself of Jewish heritage and was eight when the Nazis arrested his parents, forcing him into years of wandering that lent autobiographical authenticity to "The Pianist", the tale of a young Jewish man evading the Nazis in occupied Warsaw.
Geimer wrote a book about her encounter with Polanski in 2013, in which she said she was made to drink champagne and was given a sleeping pill before being raped by Polanski in the house of actor Jack Nicholson.
The mother of three wrote in "The Girl: A Life Lived in the Shadow of Roman Polanski" that she harbours no hate for Polanski and has forgiven him.