The departing head of the United Nations has challenged countries that use religion to justify homophobic discrimination.

Ban Ki-moon, a former South Korean official who has served as the UN Secretary General since 2007, is set to retire at the end of the year, with a successor taking office in 2017.

In a speech this week, Mr Ban reflected on his own personal journey on LGBT rights.

He admitted: “When I first became Secretary-General, I did not know much about this challenge. I learned by listening.

“Everyone who lacks understanding should listen closely. The facts are disturbing.

“Every year, hundreds are killed, thousands are badly hurt, and millions live their lives under a shadow of discrimination and disapproval. That is an outrage.

“Many Governments refuse to acknowledge human rights abuses against LGBT people – or accept responsibility for ending them.

“Several countries are bucking the tide of history with draconian new punishments for being gay – or even just talking about being gay.

“I especially worry for children and youth who are bullied at school, thrown out of their homes or living on the streets.

“These abuses will only end when countries take concrete steps to protect people: new laws, policies and programmes. This takes leadership and a commitment to work with affected communities.”

He added: “I ask those who use religious or cultural arguments to deprive LGBT people of their human rights: what do you gain by making others less equal?

“Is your religion or culture so weak that the only way you can sustain it is by denying others their basic rights?

“There is no room in our 21st century for discrimination based on sexual orientation or gender identity.

Mr Ban noted that his own actions on the issue – helping create the first UN role with responsiblity for LGBT rights, and ensuring equal benefits for gay UN employees worldwide – had come under fire.

He continued: “There is a [political] cost to speaking up – one which I am proud to pay.

“I myself have been criticised by many people around the world, by many Member States. You may not know how much I have been fighting and been criticised by certain Member States.

“When I made an administrative action to give equal pay and same allowances for those gay couples, even though their home countries do not recognise it, the United Nations for the first time has recognised that, regardless of what their home countries are doing, the UN has recognised it.

“Of course many human rights defenders have paid a far higher price.”

He also affirmed: “I will always fight for the equality of the LGBT members of our human family.

“This work will not leave me when I leave office – and it must not leave the office of the Secretary-General after I depart.

“Leadership is essential – and you do not need to have a high position to take a lofty stance.

“Let us be inspired by the countless individuals around the world who risk their lives to secure their rights – and leave our world a more free and equal place for future generations.”

He noted: “At the United Nations Human Rights Council, more than one hundred countries have accepted recommendations aimed at protecting LGBT people from discrimination.

“In some cases, the starting point has been to decriminalize gay relationships. Over the past year, three more countries have abandoned criminal sanctions following UN recommendations: Mozambique, The Seychelles and Nauru. I commend their leadership.

“Many have new laws to stop discrimination, punish hate crimes and restrict hate speech. We see new measures to end bullying and provide sensitivity training.

“Almost 40 countries now legally recognise same-sex couples. Some are looking at making it easier for transgender people to have their gender legally recognised.

“These major advances happened thanks to brave individuals who stood up for what is right.”

The new Secretary General will be elected next month.