Paedophile Gary Glitter finally agreed today to leave Thailand and return to the UK, Thai police said.
Glitter, 64, had repeatedly refused to return to Britain after Tuesday's release from prison in Vietnam, where he had been jailed for abusing two young girls.
The shamed former pop star is now expected to fly into London's Heathrow Airport after leaving the Thai capital Bangkok.
Thai police general Phongdej Chaiprawat told the Associated Press that Glitter had finally agreed to leave the country.
Glitter, whose real name is Paul Gadd, has been at the centre of an international game of ping-pong as country after country refused him leave to enter.
He has been twice refused entry into Thailand and once turned away from Hong Kong after flying out from Vietnam.
Despite Glitter agreeing to leave, Thai police said they did not know when the ageing former glam rocker would depart Bangkok or which flight he would be leaving on.
The shamed former pop star, 64, touched down in Bangkok, Thailand, for the second time in a week earlier today after being barred from Hong Kong.
On his arrival he was told by Thai authorities that he was not welcome.
Thai Police Colonel Worawat Amornwiwat said: "Thailand is not allowing him to enter the country and Hong Kong is turning him back, so there is no choice for him now.
"It is the responsibility of Thai Airways to take him out of the country."
He was stuck in international limbo as a growing list of countries said they would deny him entry and the British Government was powerless to force him to return to the UK.
But his decision to leave Bangkok could finally draw the bizarre saga to an end.
Glitter will not be relishing his return to the UK, where he can expect to be greeted by the police and a hostile press.
The farcical series of events began on Tuesday when Glitter left a Vietnamese prison after serving almost three years for abusing two girls aged 10 and 11.
He was ordered out of Vietnam and travelled to Bangkok, where he was expected to board a flight to London Heathrow under the terms of his release.
But on arrival in the Thai capital, Glitter reportedly feigned heart trouble to avoid boarding the UK-bound plane.
He was barred entry to Thailand and warned he would be taken to a detention centre if he continued to refuse to leave the country.
After spending around 20 hours in the transit lounge at Bangkok airport, Glitter boarded a flight to Hong Kong last night in the hope that he would be accepted there.
But the Chinese authorities barred him entry and he was put back on a Thai Airways flight to Bangkok arriving at around 7am UK time today.
Immigration police in Bangkok said it was the responsibility of Thai Airways to make sure Glitter left the country.
It is believed that the airline had today been trying to convince Glitter to board the next available flight from Bangkok to London.
A spokeswoman for Thai Airways refused to comment on Glitter's current situation.
Home Secretary Jacqui Smith said Britain could not enforce Glitter's return but must have a plan if he did.
When the former glam rock star arrives in the UK, he will be met at the airport by police officers and served with an order which will effectively put him on the sex offenders register.
Glitter was convicted of downloading child pornography in the UK in 1999 after a computer repair shop found the images on his laptop and he served two months of a four-month sentence.
He left the country and moved to Spain and Cuba before travelling to south east Asia, where he escaped detection until he was tracked down by reporters.
He was kicked out of Cambodia after facing allegations of sex crimes and moved to the Vietnamese coastal resort of Vung Tau.
The two girls at first made allegations of rape, which carries a death sentence, but were reportedly paid off with £1,175.
Glitter was arrested trying to leave the country and stood trial, pleading not guilty and claiming he was teaching the girls English. He was convicted and sentenced to three years in March 2006.
Zoe Hilton, policy adviser at the NSPCC, said: "This clearly illustrates why it's so important to have binding agreements between countries which will prevent sex offenders hopping from one place to another and possibly going underground where they will pose a serious threat to children.
"Offenders like Glitter can and should be chaperoned while being deported back to the UK where they can be properly monitored. It is disappointing this latest development was not anticipated and proper arrangements put in place to make this work.
"This case is important because it highlights how easy it is for UK offenders to move around freely when they are overseas - even those who pose a high risk to children."