Lesbian, gay, bisexual, and transgender (LGBT) people in Tanzania face severe challenges not experienced by non-LGBT residents. Homosexuality in Tanzania is a socially taboo topic, and same-sex sexual acts (even in private and consensual) are criminal offences, punishable with life imprisonment. The law also criminalises heterosexuals who engage in oral sex and anal intercourse.
 According to the 2007 Pew Global Attitudes Project, 95 percent of Tanzanian residents believed that homosexuality is a way of life that society should not accept, which was the seventh-highest rate of non-acceptance in the 45 countries surveyed.
 According to Afrobarometer 2020 poll only 10 percent of Tanzanians would be tolerant of someone with a different sexual orientation which is among the lowest in Africa but higher than a 2007 poll.
 In recent years, Tanzania has become particularly hostile to LGBT people. In October 2017, it deported staff of several HIV/AIDS groups on the basis of "promoting homosexuality". Tanzania has a high HIV/AIDS rate and reportedly one million people are infected. The Government has increasingly resorted to homophobic rhetoric, alleging that homosexuality is "un-African". In 2018, a so-called "witch hunt" was declared against gay people in Dar es Salaam, where gay men were forced to endure anal examinations and torture. Tanzania has a poor human rights record. Government respect for freedom of speech and freedom of assembly is declining.
 Despite this, there have been several Tanzanian human rights campaigners, activists, lawyers and feminists like Maria Sarungi, Fatma Karume, Mwanahamisi Singano, Carol Ndosi, Zara Kay, Khalifa Said, Goodluck Haule and many others who have openly supported LGBT rights whilst openly opposing state-sanctioned homophobia and dangerous rhetoric from government officials who have called for further persecution of these marginalized groups.[citation needed] Promoters of anti-LGBT campaigns have included the former president Magufuli, Paul Makonda, Ally Hapi, and Hamisi Kigwangalla.
 Prior to colonisation, various modern-day Tanzanian ethnic groups accepted homosexuality or viewed it with indifference.
 The Swahili people had traditions of acceptance towards homosexuality. Homosexuals are known as shoga (plural: mashoga), and historically had certain social roles, such as drumming and playing music at marriages and other festivals. The word shoga was also used by women to refer to "friends". Over time, shoga relationships turned into economic relations, with poorer young men being paid by richer older men (basha, plural: mabasha) for sexual relations. Socially, only the mashoga were regarded as "homosexual", the mabasha would usually have a wife.
 Mombasa's mashoga are passive male homosexuals offering their persons for money. They advertise themselves in bright tight male attire in public places, usually, but may, when mingling with women at weddings, don women's leso cloths, make-up and jasmine posies. Mashoga have all the liberties of men and are also welcome in many contexts otherwise exclusive to women. Lesbians relationships were also commonplace in Swahili society. Lesbians (known as msagaji or msago (plural: wasagaji or misago), literally 'grinders') also had certain societal roles, including doing tasks typically associated with men. Similarly to shoga relationships, msagaji relationships were also defined for economic purposes, though less so. The older partner (mama (plural: mwana)) was typically wealthier and of a higher social class. Women who resisted marriage and were interested in education and careers were perceived as being wasagaji, regardless of their actual sexual orientation. Collectively, homosexuals were called mke-si-mume (literally 'woman, not man').
 Among the Maasai people, traditions of cross-dressing were common and typically performed at rituals. During initiation rituals, young male Maasai would often dress as women and wear the surutya (ear-rings worn by women to show that they are married) and other female garments.
 Among the Kuria people, lesbian marriages were, and still are to some extent, quite commonplace. Though now not perceived as being "homosexual", these marriages are performed for economic and diplomatic purposes, such as when a family has no son.
 Societal acceptance and tolerance of homosexuality and same-sex relationships quickly disappeared after the arrival of the Europeans. Laws punishing homosexuality were enacted, and over time homophobia has become deeply ingrained in the population. In 2015, Adebisi Ademola Alimi, then a lecturer at the Humboldt University of Berlin, discussed this omnipresent homophobia in, not only Tanzania, but in Africa as a whole.
 One factor is the increased popularity of fundamental Christianity, by way of American televangelists, since the 1980s. While Africans [argue] that homosexuality was a western import, they in turn [use] a western religion as the basis for their argument. When I have challenged people who are anti-gay, many have said that it is not our culture. However, when you probe further, they argue that homosexuality is not in the Bible. But the Bible is not our historical culture. This shows there is real confusion about Africa's past. Throughout Tanzania, sex acts between men are illegal and carry a maximum penalty of life imprisonment. Sex acts between women are not mentioned specifically in mainland Tanzanian law. The semi-autonomous region of Zanzibar outlaws same-sex sexual acts between women with a maximum penalty of five years imprisonment or a TSh 500,000/= fine. Heterosexual oral and anal sex is also illegal.
 The Penal Code of 1945 (as revised by the Sexual Offences Special Provisions Act, 1998) of Human rights in Tanzania provides as follows:
 Section 138A. Acts of gross indecency between persons.
 According to Part I(3) of the Sexual Offences Special Provisions Act, 1998, "gross indecency" in Section 138A "means any sexual act that is more than ordinary but falls short of actual intercourse and may include masturbation and indecent physical contact or indecent behaviour without any physical contact".
 Section 154. Unnatural offenses.
 commits an offence, and is liable to imprisonment for life and in any case to imprisonment for a term of not less than thirty years. ...
 Section 155. Attempt to commit unnatural offences.
 Section 157. Indecent practices between males.
 is guilty of an offence and may be sentenced to five years of imprisonment.
 The Zanzibar Penal Code of 1934, as amended in 2004, provides as follows:
 Section 150. and also who
 is guilty of a felony, and is liable to imprisonment for a term not exceeding fourteen years.
 Section 151.
 Section 153.
 Section 154.
 According to Section 4, "gross indecency" means "any sexual act that falls short of actual intercourse and may include masturbation and physical contact or indecent behaviour without any physical contact."
 Section 158.
 shall be guilty of an offence and liable on conviction to imprisonment for a term not exceeding seven years.
 Same-sex couples have no legal recognition.
 A couple is eligible to adopt a child jointly only if the couple is married. A man may adopt a female child as a sole applicant only if "the court is satisfied that there are special circumstances which justify as an exceptional measure the making of an adoption order". There are no special restrictions on a female adopting a male child as a sole applicant. Only a Tanzanian resident who is at least 25 years of age may adopt a child. An LGBT person is not specifically prohibited from adopting. "Child" means a person under 21 years of age who has never been married.
 There are no gay bars, although there are some places where gay men meet. Lesbians are less visible than gay men.
 Neither the Constitution nor the statutes of Tanzania specifically prohibit discrimination based on sexual orientation or gender identity.
 In November 2018, Paul Makonda, Dar es Salaam's Regional Commissioner, announced that a special committee would seek to identify and punish homosexuals, prostitutes and online fraudsters in the city. A 17-strong committee consisting of police, lawyers and doctors had been formed to identify homosexuals. The committee would scour the internet to identify videos featuring supposedly LGBT people. The Foreign Ministry stated that the planned crackdown did not have the support of the Government. Denmark, one of Tanzania's largest aid provider, withheld 65 million kr. (£7.5 million stg; US$9.8 million) over the programme.
 In October 2017, the Government deported staff of HIV/AIDS groups for "promoting homosexuality".
 The U.S. Department of State's 2013 Human Rights Report noted:
 On June 19, [2013] Human Rights Watch and the Wake Up and Step Forward Coalition released a report including several detailed allegations of torture and abuse of lesbian, gay, bisexual, and transgender (LGBT) individuals while in police custody. For example, the report included a statement from a 19-year-old gay man who was arrested after departing a nightclub in Mbeya. The individual reported police raped and beat him on the soles of his feet with canes, electric wires, and water pipes. In 2003, over 300 Tanzanians protested against the arrival of a gay tour group. In 2004, several Islamic groups in Zanzibar began an effort to cleanse the nation of activities it considered sinful, including homosexuality. The law in Zanzibar that criminalizes same-sex acts was amended to impose harsher penalties for those activities.
 The United Nations Human Rights Council in October 2011 at its meeting in Geneva completed a Universal Periodic Review (UPR) of the human rights situation in Tanzania. At this UPR, Slovenia, Sweden, and the United Nations Country Team (UNCT) publicly urged Tanzania to repeal its statutes that criminalize same-sex sexual activities. The UNCT said in paragraph 27 of its report:
 Homosexuality is considered contrary to cultural norms; same sex sexual relations are criminalized. Group arrests in connection with peaceful assemblies, non-attendance to HIV patients, as well as forcible evictions of persons due to their sexual orientation by local and religious communities have been reported. Moreover, representatives of the groups and other human rights defenders may not be willing to make public statements in favor of tolerance and decriminalization for fear of reprisals. Tanzania refused. Mathias Meinrad Chikawe, the Tanzanian Minister of State and Good Governance, said in Geneva,
 There was an issue raised on same-sex marriages, etc. It is true we do not have a law allowing same-sex marriages in our country, and that I say again, due to our own traditions and very cultural strong beliefs. Although activities involving same-sex do take place, but they do take place under cover, so to say, and like I said when I was presenting our report on the ICCPR [International Covenant on Civil and Political Rights], that if one were to exhibit such a behaviour in public, one could be, actually be stoned by the public itself. It is a cultural thing. It's not yet acceptable. So the government ... it would be very strange for the government to propose a law towards allowing that; so, it's just that maybe time has not come for us to consider such freedoms in our country. In October 2011, at the Commonwealth Head of Government's meeting in Perth, Australia, the Prime Minister of the United Kingdom, David Cameron, said that the UK may withhold or reduce aid to governments that do not reform statutes criminalizing homosexuality. In response, Tanzania's Minister for Foreign Affairs and international cooperation, Bernard Membe, said,
 Tanzania will never accept Cameron's proposal because we have our own moral values. Homosexuality is not part of our culture and we will never legalise it. ... We are not ready to allow any rich nation to give us aid based on unacceptable conditions simply because we are poor. If we are denied aid by one country, it will not affect the economic status of this nation and we can do without UK aid. In the Tanzanian Parliament on 11 November 2011, the Tanzanian Prime Minister, Mizengo Pinda, responded to a question from an MP about whether the Government was prepared to lose aid from the UK. He said:
 You are not being fair to me as the government has already made its stand clear on the matter ... but since you want to get my opinion, I would like to say that homosexuality is unacceptable to our society. We need to look critically on these issues. To me this is unacceptable. Even animals can't do such a thing. His statement is biologically and scientifically counterfactual, as homosexuality has been observed among thousands of animal species, including Tanzania's national animal, the giraffe. Males of the species, especially, engage in high levels of same-sex sexual behaviour, with up to 94 percent of all acts of "mounting", being male-male.
 In the Tanzanian Parliament on 20 June 2012, Membe responded to a question from MP Khatib Said Haji, about the position of the government on the pressure by Western countries demanding abolition of anti-gay laws. Membe said: "We are ready to lose aid and support from friendly countries that are now pushing for repeal of anti-gay laws in African nations" and that Tanzania was ready to go it alone rather than being subjected to humiliation and dehumanization.
 "Consensual same-sex sexual conduct is illegal on the mainland and on Zanzibar. On the mainland, acts of 'gross indecency' between persons of the same sex are punishable by up to five years in prison. The law refers to same-sex sexual conduct as an 'unnatural offense' and carries a prison sentence of 30 years to life. The law on Zanzibar establishes a penalty of up to 14 years in prison for men who engage in same-sex sexual conduct and five years for women. The burden of proof in such cases is significant. According to a recent Human Rights Watch report, arrests of LGBT persons rarely led to prosecutions; usually they were a pretext for police to collect bribes or coerce sex from vulnerable people. Nonetheless, the CHRAGG's [Commission for Human Rights and Good Governance] 2011 prison visits revealed that 'unnatural offenses' were among the most common reasons for pretrial detention of minors. In the past courts have charged individuals suspected of same-sex sexual conduct with loitering or prostitution. LGBT persons faced societal discrimination that restricted their access to health care, housing, and employment. This group was also denied health care such as access to information about HIV. There were no known government efforts to combat such discrimination."