A Syrian refugee who spent several months in limbo in a budget terminal at a Malaysian airport has been granted permanent residency by Canada and is en route to Vancouver.

Hassan al-Kontar's plight became widely known after he shared posts on social media that showed him surviving on donated airline meals, washing and giving himself a haircut in the toilets at Kuala Lumpur International Airport's Terminal 2.

He had been stuck since March - blocked from entering Malaysia because of visa issues and barred from travelling to other countries, and was detained last month by immigration officials.

"I know I look like someone who ran from the stone, middle ages. I'm sorry for that" the smiling 36-year-old said in a Twitter video, looking tired and stroking his beard.

"For the last eight years, it was hard, long journey. The last ten months, it was very hard and cold."

Malaysian officials earlier said they were going to work with Syrian authorities to deport him back to his war-torn homeland.

But his lawyer Andrew Brouwer said they brought Mr Kontar directly to the Kuala Lumpur airport yesterday before he was put on a Vancouver-bound flight.

Mr Brouwer said his client was recognised by Canada as a refugee and was granted permanent residency under the country's refugee sponsorship programme.

"We were of course very pleased that Malaysia appeared to agree and abide by international law," he said.

In the video on his Twitter account Mr Kontar said he was in transit in Taiwan and that he would be reaching his "final destination" the following day.

"I could not do it without the support and the prayers from all of you," he said.

Mr Kontar is not the only asylum seeker who has been left in limbo at an airport for a long period of time.

In 2015 an Iraqi family spent more than two months in an empty smoking cubicle in a Moscow airport, relying on passengers to bring them food and water.

Mr Kontar's case also recalls the 2004 film ‘The Terminal’, in which Tom Hanks plays a man who finds himself stuck in a New York airport after his government collapses, rendering his papers useless.

Millions of Syrians have fled a devastating seven-year civil war that has left more than 350,000 people dead.