A Swiss court has accepted film-maker Roman Polanski's plea to be freed on $4.5m bail from a Swiss jail where he is being held for a US child sex case.
The court said Polanski could stay at his chalet in the Swiss Alps. He would be monitored by an electronic tag.
Polanski, 76, has been wanted in the US since fleeing the country in 1978 after pleading guilty to having unlawful sex a year earlier with a 13-year-old girl.
He was held in Zurich after travelling from France in September.
On Wednesday, the Swiss Federal Criminal Court accepted Polanski's bail plea and his offer to surrender his passport.
The court said Polanski would be subjected to "constant electronic surveillance" at his chalet and an electronic tag would be activated if he attempted to leave the premises.
It also said that Polanski - who holds dual French and Polish citizenship - would stay in the prison pending a possible appeal against the ruling.
The Swiss justice ministry has 10 days to appeal against the court's decision.
But Justice Minister Eveline Widmer-Schlumpf said she saw no reason to appeal against the decision.
It is highly unusual for extradition subjects to be granted bail in Switzerland, says the BBC's Imogen Foulkes, adding that Polanski's first application was refused.
But this time the court ruled bail conditions should be enough to prevent him fleeing back to France, our correspondent says.
The ruling is not thought to affect the Swiss government's ongoing assessment of whether it should extradite Polanski to the US.
Polanski has not set foot in the US since fleeing the country in 1978, and has settled in France.
Speaking after detention in September, US prosecutors disputed claims that his arrest came out of the blue, saying he had been on an Interpol "wanted list" for years.