The United Nations Secretary General Ban Ki-moon has told African leaders that they must respect gay rights in an unusually outspoken declaration made at an African Union summit in Ethiopia.

Mr Ban told delegates at the event held in Addis Ababa: “One form of discrimination ignored or even sanctioned by many states for too long has been discrimination based on sexual orientation or gender identity.

“It prompted governments to treat people as second-class citizens or even criminals.”

Homosexuality is illegal in many African countries and there is widespread discrimination in those that do not outlaw gay sex. Only South Africa recognises LGBT rights in its constitution and allows gay marriage.

“Confronting these discriminations is a challenge, but we must not give up on the ideas of the universal declaration of human rights,” Mr Ban told the summit.

Last year, the British government said it would divert aid away from African governments that discriminate against LGBT citizens prompting Zimbabwean president Robert Mugabe to describe the arrangement as ‘satanic’. He said: “It becomes worse and satanic when you get a prime minister like Cameron saying countries that want British aid should accept homosexuality. To come with that diabolic suggestion to our people is a stupid offer.”

African Union chairman Tedoro Obiang Nguema, speaking before Mr Ban said: “Africa should not be questioned with regards to democracy, human rights, governance and transparency in public administration,”

In 2010, Mr Ban made a very public call for the end to discrimination against LGBT people saying: “As men and women of conscience, we reject discrimination in general, and in particular discrimination based on sexual orientation and gender identity. When individuals are attacked, abused or imprisoned because of their sexual orientation, we must speak out.

“We cannot stand by. We cannot be silent.

“This is all the more true in cases of violence. These are not merely assaults on individuals. They are attacks on all of us. They devastate families. They pit one group against another, dividing larger society. And when the perpetrators of violence escape without penalty, they make a mockery of the universal values we hold dear.

“We have a collective responsibility to stand against discrimination, to defend our fellow human beings and our fundamental principles.”