Laws on homosexuality in African nationsMonday 24 February 2014 11.57
Many African countries, with the notable exception of South Africa, have laws that ban or repress homosexuality.
Uganda's president today signed into law a bill that includes life terms for those convicted several times of practising homosexuality.
According to a report by rights group Amnesty International in June, homosexuality was illegal in 38 out of 54 countries in the region, and punishable by death in Mauritania, Sudan and Somalia.
The following are some of the countries that have adopted repressive laws against homosexuals:
Uganda: Ugandan President Yoweri Museveni signed into law a controversial bill that establishes life terms in prison for repeat homosexuals, despite pressure from Western partners.
The law also outlaws the promotion of homosexuality and requires people to denounce gays.
Nigeria: A law that took effect in January provides for jail terms of up to 14 years for gay couples who live together and ten years for public displays of affection between gays.
Homosexuality also carries the death sentence in northern states where Islamic law runs parallel to the state and federal justice systems, though the punishment is rarely, if ever, applied.
Cameroon: Homosexual relations can be punished with up to five years in prison.
Gambia: Homosexuality is punishable by up to 14 years in prison.
Zambia: Same-sex relationships have been banned since British colonial rule, and a sodomy conviction carries a 14-year prison sentence.
Senegal: Anyone convicted of an "improper or unnatural act with a person of the same sex" faces up to five years in jail.
Tunisia: Sodomy between consenting adults is punishable by up to three years in prison.
Morocco: Homosexuality is punishable by six months to three years in prison, but is tolerated in practice provided practitioners do not flaunt their sexual orientation.
Algeria: Anyone charged with a homosexual act faces up to two years in prison, but people are rarely prosecuted.
In several countries homosexuality is a taboo subject, but with certain zones of tolerance:
Zimbabwe: President Robert Mugabe is known for saying that gays and lesbians are "worse than pigs and dogs". However, the group Gays and Lesbians is authorised.
Malawi: In November 2012, President Joyce Banda suspended sodomy laws until they are debated by parliament.
Under the country's penal code, men can be sentenced to up to 14 years and women to five years for homosexuality.
Other countries, such as Chad, Gabon, Ivory Coast and Mali do not criminalise homosexuality, but South Africa leads the way on gay rights.
Since the end of apartheid in 1994, South Africa has had one of the world's most liberal legal frameworks for homosexuals.
The constitution bans all discrimination based on sexual orientation.
The parliament legalised gay marriage in 2006, making the country the only one in Africa to recognise unions between people of the same sex.
But despite these laws, gay people in South Africa still face homophobia and violence.