Nicholas Warner, a British man who has been living rough on the streets of Dubai, is travelling back to the UK.
With help from locals and an expat sponsor, he obtained the release of his passport from the authorities.
Mr Warner had been sleeping in parks and public places around the city for nearly 12 weeks.
He said his problems began when he got into a dispute with his bank, Emirates NBD, initially over whether his credit card repayments had been made.
The bank has said that all its actions have been in accordance with the law of the United Arab Emirates.
'Wanted to pay'
The temperature in Dubai this summer has regularly touched 50C and Mr Warner has survived by spending as much time as possible in air-conditioned places, from shopping malls to supermarkets to hospitals, before being asked to leave.
"I wanted to pay my debt," he said.
"If the bank had let me get a job back when all this started, it would have been paid off weeks ago."
He added: "I've got to get on with my life now."
When he went on holiday at Christmas, the bank said that by leaving the country without its permission while they were in a dispute, he was reclassified as a so-called "debt skipper" - one of the many expats who left Dubai in a hurry with large debts, never to return.
When Mr Warner arrived back at Dubai airport, he was arrested. His passport was seized by police on the authority of the bank.
Although he was released and tried to negotiate with the bank he got into further difficulties. Brushes with the authorities are frowned upon in Dubai, so he lost his job.
Now he had no job, no way to pay the debt the bank was demanding and no passport - leaving him with no way home.
Emirates NBD refused to release his passport until the debts were paid, but he had no way of paying them without a job.
And he could not get a job without being able to show he was in the country legally. For that, he needed his passport.
After Mr Warner got in contact with the BBC, his story received a lot of media attention in Dubai.
Locals, as well as European and Indian expats offered him legal assistance, places to stay and money to help pay off his debt.
One group managed to find a way to get his passport released by the Dubai judicial system by paying about £8,000 directly to the courts, circumventing the bank.
After checking the passport was free of any travel bans, they bought him a flight back to England.
Mr Warner says he was unable to reach an agreement with Emirates NBD that was satisfactory to both sides.
The bank says it has made him several offers in the last month, but he says that each of these offers came with conditions that made it untenable.
Emirates NBD has released a statement about the case.
"All actions by the bank in this matter have been in accordance with prevailing UAE laws, and in line with the contractual agreement signed by the customer who was unable to meet his commitments and approach the bank for appropriate settlement of his dues"