Yew Fook Sam (who goes by Sam) can't return to Malaysia because of homophobic persecution. (Twitter)

A gay Malaysian man, after months of agony and disputes, has won the right to remain in the UK in the face of being deported back to his home country and potentially prosecuted, beaten up or even killed.

Being gay is punishable by up to 20 years imprisonment under a British Empire colonial law that, while rarely enforced, continues to cast a shadow over the LGBT+ community in Malaysia.

People petitioned and applied pressure to the Home Office after Yew Fook Sam’s final appeal was rejected in February.

But in what supporters have dubbed an “early Christmas present”, the 67-year-old was granted a five year leave to remain in the UK as of today.

Gay pensioner told he is not gay because he is single.

Arriving to the UK in 2005 with a sponsorship to work for a Chinese restaurant in London, he fled Malaysia after his wife discovered he was gay in 1988.

He explained to Gay Star News that he got hitched aged 30. But his wife then took his two children and left to America after Sam was outed. Leaving him behind.

In 2016, immigration officials detained him for 10 months for working illegally. Trapped in an immigration centre before being housed in Home office accommodation in Liverpool.

While there, Sam surrounded himself with the local LGBT+ community. Taking part in Prides and even joining Open Table, a Christian LGBTI support community that his church, St Brides, is part of.

However, Sam’s status was plunged into disarray after immigration authorities rejected his claim.

They alleged that, despite Sam being practically a piece of furniture in the LGBT+ scene in Liverpool, he was not gay.

Their basis, officials said, was that he was “single”. Therefore, he cannot be gay.

‘Sam is so relieved and delighted to receive the news, an early Christmas present for him.’

Moreover, this forced Sam to have to report to officials once a fortnight. With his legal status in the UK hanging by a thread, he feared that any one of these meetings would end with his deportation.

As a result, Liverpool’s LGBT+ community as well as Sam’s church banded together and started a petition that ultimately tallied nearly 5,000 signatures pleading for Sam to be allowed to remain in the UK.

“Thank you all for your support and encouragement – it has meant so much to Sam and helped him keep his hope alive,” St Bride’s wrote in a statement issued today.

“Sam is so relieved and delighted to receive the news, an early Christmas present for him.”

Reports and testimonies have gradually revealed a Home Office playbook, one where department workers gauge a queer seeker’s application based on troubling methods.

Such as using a seeker’s dependency on homophobic or transphobic friends or family to discredit their applications, some seekers alleged, or not believing an applicant to be queer if they do not fit certain stereotypes.