Egypt has upheld the decision to deport a man to Libya after he was accused of homosexuality, in a case that human rights groups fear could allow authorities to force gay migrants to leave the country or ban them from entering.

Ahram Online reports that Egypt’s administrative court rejected an appeal by the unnamed man on Tuesday, who was arrested in 2008 after a legal complaint was filed accusing him of being gay and he was subsequently deported.

The Libyan national had appealed the interior ministry’s decision to deport him on the basis that he needed to return to complete his studies at Cairo's Arab Academy for Maritime Transport. However, the court upheld the ruling, claiming that it was in the public interest and in the interest of religious and social values.

Amnesty International said the decision to refuse him re-entry into the country sets a “very dangerous precedent” for migrants and refugees.

Nicholas Piachaud, Amnesty’s Egypt researcher, told The Independent: “It puts his life at risk and casts a long shadow over the lives of refugees and asylum seekers in Egypt. The ruling comes despite the fact that the United Nations Refugee Agency says no-one should be forcefully returned to Libya until the human rights situation improves.

“We have to see it in the context of Egypt’s security forces regularly rounding up dozens of people on allegations they are gay or have engaged in consensual same-sex relationships. The mere suspicion that they are gay seems to be enough to arrest people.”

In pictures: LGBT activists protest against 337 Show all 10 1 /10 In pictures: LGBT activists protest against 337 In pictures: LGBT activists protest against 337 LGBT activists protest against 337 An Indian LGBT activist holds a placard during a demonstration against the Supreme Court's reinstatement of Section 377, which bans gay sex in a law dating from India's colonial era, in Bangalore Getty In pictures: LGBT activists protest against 337 LGBT activists protest against 337 Indian LGBT activists hold placards as they demonstrate against the Supreme Court's reinstatement of Section 377 Getty In pictures: LGBT activists protest against 337 LGBT activists protest against 337 India's top court rejected a plea filed by the government and activist groups to review its shock ruling which reinstated a colonial-era ban on gay sex Getty In pictures: LGBT activists protest against 337 LGBT activists protest against 337 Members and supporters of various progressive movements including the lesbian, gay, bisexual, transgender (LGBT) community participate in a joint rally on India's 65th Republic Day in New Delhi Getty In pictures: LGBT activists protest against 337 LGBT activists protest against 337 Around 200 people, including many gays and lesbians, joined together in a Republic Day March to highlight minority issues including gay, women, dalits and disability amongst others. India has recently seen a reversal of a major gay right after the country's court criminalized gay sex Getty In pictures: LGBT activists protest against 337 LGBT activists protest against 337 Indian gay rights activists pose during a protest against the Supreme Court ruling reinstating a ban on gay sex in Kolkata. India's Supreme Court reinstated a colonial-era ban on gay sex on that could see homosexuals jailed for up to ten years in a major setback for rights campaigners in the world's biggest democracy Getty In pictures: LGBT activists protest against 337 LGBT activists protest against 337 An Indian gay-rights activist holds a poster during a protest against the Supreme Court ruling reinstating a ban on gay sex, in Kolkata. India's Supreme Court reinstated a colonial-era ban on gay sex on that could see homosexuals jailed for up to ten years in a major setback for rights campaigners in the world's biggest democracy Getty In pictures: LGBT activists protest against 337 LGBT activists protest against 337 An Indian activist holds a flag as he shouts slogans during a rally to protest against the Supreme Court ruling reinstating a ban on gay sex in Mumbai Getty In pictures: LGBT activists protest against 337 LGBT activists protest against 337 India's Supreme Court reinstated a colonial-era ban on gay sex on that could see homosexuals jailed for up to ten years in a major setback for rights campaigners in the world's biggest democracy Getty In pictures: LGBT activists protest against 337 LGBT activists protest against 337 An Indian activist shouts slogans during a rally to protest against the Supreme Court ruling reinstating a ban on gay sex in Mumbai Getty

Mr Piachaud said that while being gay is not strictly illegal in Egypt, people are often arrested and charged with habitual debauchery, often alongside other charges relating to prostitution.

“Legally speaking, being gay is not explicitly outlawed, but in practice, security forces have used the law to punish people they think might be gay or have a different viewpoint,” he added.

“What happened on Tuesday is that by rejecting the appeal, the court set a very dangerous precedent by saying that the interior ministry is in fact allowed to detain foreign nationals and deport them on the grounds that they are alleged to be gay or LBGT.”

Graeme Reid, the director of Human Rights Watch’s LBGT programme, blasted the decision for encroaching on the privacy of individuals living in the country.

“The decision of the Egyptian administrative court that it is lawful to expel or bar entry to gay foreigners in order to ‘protect public interest and religious and social values’ runs counter to Egyptian law,” he said. “It is not illegal to be gay in Egypt.