The United Nations has endorsed the rights of gay, lesbian and transgender people for the first time ever, passing a resolution hailed as historic by the US and other backers and decried by some African and Muslim countries.
The declaration was cautiously worded, expressing "grave concern" about abuses because of sexual orientation and commissioning a global report on discrimination against gays.
But activists called it an important shift on an issue that has divided the global body for decades, and they credited the Obama administration's push for gay rights at home and abroad.
"This represents a historic moment to highlight the human rights abuses and violations that lesbian, gay, bisexual and transgender people face around the world based solely on who they are and whom they love," US Secretary of State Hillary Clinton said in a statement.
Following tense negotiations, members of the Geneva-based UN Human Rights Council narrowly voted in favour of the declaration put forward by South Africa, with 23 votes in favour and 19 against.
Backers included the US, the European Union, Brazil and other Latin American countries.
Those against included Russia, Saudi Arabia, Nigeria and Pakistan. China, Burkina Faso and Zambia abstained, Kyrgyzstan did not vote and Libya was suspended from the rights body earlier.
The resolution expressed "grave concern at acts of violence and discrimination, in all regions of the world, committed against individuals because of their sexual orientation and gender identity".
More important, activists said, it also established a formal UN process to document human rights abuses against gays, including discriminatory laws and acts of violence.
According to Amnesty International, consensual same-sex relations are illegal in 76 countries worldwide, while harassment and discrimination are common in many more.
"Today's resolution breaks the silence that has been maintained for far too long," said John Fisher of the gay rights advocacy group Arc International.
The White House in a statement strongly backed the declaration.
"This marks a significant milestone in the long struggle for equality, and the beginning of a universal recognition that (lesbian, gay, bisexual and transgender) persons are endowed with the same inalienable rights - and entitled to the same protections - as all human beings."
The resolution calls for a panel discussion next spring with "constructive, informed and transparent dialogue on the issue of discriminatory laws and practices and acts of violence against" gays, lesbians and transgender people.
The prospect of having their laws scrutinised in this way went too far for many of the council's 47-member states.
"We are seriously concerned at the attempt to introduce to the United Nations some notions that have no legal foundation," said Zamir Akram, Pakistan's envoy to the UN in Geneva, speaking on behalf of the Organisation of the Islamic Conference.
Nigeria claimed the proposal went against the wishes of most Africans. A diplomat from the north west African state of Mauritania called the resolution "an attempt to replace the natural rights of a human being with an unnatural right".