World leaders have paid tribute to Nelson Mandela at a memorial service in Soweto – on the same day 17 years ago he famously signed South Africa’s landmark Constitution outlawing discrimination, including on the basis of sexual orientation.

Officially endorsed by Mandela as president on 10 December 1996, the document allowed campaigners in South Africa to advance LGBT equality over the course of the next decade.

South Africa became the first and so far only country in Africa to legalise marriage rights for same-sex couples in 2006. 

Mandela died last Thursday following a long illness at the age of 95.

US President Barack Obama said Mandela was a “giant of history”, describing him as the last great liberator of the 20th century.

He told a jubilant and emotional crowd in Soweto’s FNB Stadium: “To the people of South Africa – people of every race and walk of life – the world thanks you for sharing Nelson Mandela with us.

“His struggle was your struggle. His triumph was your triumph. Your dignity and hope found expression in his life, and your freedom, your democracy is his cherished legacy.”

Comparing Mandela to Gandhi and Martin Luther King, President Obama said: “Born during World War I, far from the corridors of power, a boy raised herding cattle and tutored by elders of his Thembu tribe – Madiba would emerge as the last great liberator of the 20th century.”

President Obama told how he had been inspired by Mandela’s story and the struggle against apartheid as a student.

He said: “It stirred something in me. It woke me up to my responsibilities – to others, and to myself – and set me on an improbable journey that finds me here today.

“And while I will always fall short of Madiba’s example, he makes me want to be better. He speaks to what is best inside us.”

Tuesday also marked World Human Rights Day, a fitting tribute to arguably one of the world’s most powerful human rights advocate.

UN Secretary General Ban Ki-Moon said Mandela had a smile that “lit up the world,” adding: “It is our duty to keep his memory alive and embody his example in our lives.”