Gay and transgender people in Tanzania have gone into hiding, fearing for their lives, after a senior government official called on the public to report suspected homosexuals so that they could be arrested from early next week.

Paul Makonda, regional commissioner for Tanzania's main city of Dar es Salaam, announced the crackdown on Monday. He said a team would be set up to identify and arrest the "many homosexuals", who could face up to 30 years in jail.

Mr Makonda's announcement has sparked panic and fear among thousands of LGBT people in the east African nation. Some said they were too scared to go outside during the day, while others had left their homes fearing imminent arrest.

"Since Monday, I have left my place and have been moving here and there. I am always looking over my shoulder in case they coming for me," Nathan, 24, told Reuters by phone from Dar es Salaam.

"There's so much tension within the gay community at the moment. Not just in Dar, but all over the country. We are really scared. We don't know what to do and where to go."

Gay sex is illegal in Tanzania, but the law is rarely enforced. Homophobia and attacks and arrests on lesbian, gay, bisexual and transgender people have however risen since President John Magufuli's election in 2015, activists say.

Even though the clampdown is set to begin on Monday, Nathan claimed that homes were already being raided in the port city and gay people were arrested.

African countries have some of the most prohibitive colonial-era laws against homosexuality in the world. Same-sex relationships are seen as taboo and are a crime across most of the continent, with punishments ranging from imprisonment to death.

As a result, the persecution, discrimination and exploitation of Africa's sexual minorities is rife, say campaigners.

They are routinely abused, blackmailed, assaulted by mobs, or raped by police or vigilantes. Many are unable to get jobs due to their sexual identity - forcing them to sell sex through social media sites.

Tanzania has had a reputation for being more tolerant than its neighbour Uganda but, since President Magufuli came to power three years ago, campaigners say the little protection, representation and freedom LGBT people had is now being slowly eroded.

Civil society organisations supporting gay people have been shut down and activists have been arrested. Authorities have also suspended HIV/AIDS prevention programmes for gay men.

In June last year, President Magufuli said that "even cows" disapprove of homosexuality.

Mr Makonda told a news conference on Tuesday that he had already received over 5,700 messages from the public - with over 100 names of suspected gays.

A 17-member committee is also being set up, he said, which would be tasked with identifying gay people on social media sites such as Facebook and Twitter and arresting them.

Campaign group Equality Now said it was appalled and alarmed by the crackdown - which also targets sex workers. It called on the federal government to condemn Mr Makonda's statement and to enact laws and policies to protect the rights of all.

"People who are LGBT and in prostitution are already frequently ostracised and face multiple levels of violence and inequality," said Equality Now's Tsitsi Matekaire.

"Arresting them perpetuates this inequality, resulting in further marginalisation and damage to their well being."

LGBT people in Tanzania said foreign donors must pressurise the government to abandon the anti-gay campaign.

A previous crackdown on the LGBT community in 2016 was abandoned by authorities, they said, as a result of widespread condemnation by the international community.

They also called the United Nations to protect them by providing them with safety in another country.

"I haven't left my house during the day for the last four days. I am scared to death," said 19-year-old sex worker Michael, by phone from the northeastern city of Arusha.

"We have no one to protect us. We ask the United Nations and other countries to help us to go somewhere else where we do not have to hide in fear."