The top human rights body of the United Nations voted on Thursday to appoint an independent monitor to help protect gay and transgender people around the world from violence and discrimination.

The U.N. Human Rights Council, based in Geneva, creates an “independent expert” charged with identifying the root causes of violence and discrimination against people based on their sexual orientation and gender identity, and then talking with governments about ways to protect them.

The resolution that passed was the United Nations’ most overt expression of gay rights as human rights, and is considered a milestone.

The vote on the 47-member council passed only narrowly, with 23 nations in favor, primarily from Europe and Latin America. Though that was not a majority, six countries abstained, including India, South Africa and the Philippines. The 18 votes against it came from Russia, Africa and most of the Muslim countries on the panel. Albania was the only member of the Organization of Islamic Cooperation to favor creating an envoy for LGBT issues. The seats periodically rotate, and the United States currently does not sit on the council.

In a bow to the sensitivities of those countries where homosexuality is widely frowned upon, the resolution had a last-minute amendment added noting that “the significance of national and regional particularities and various historical, cultural and religious backgrounds must be borne in mind.” Nevertheless, it adds, “It is the duty of States, regardless of their political, economic and cultural systems, to promote and protect all human rights and fundamental freedoms.”

Randy Berry, the State Department’s Special Envoy for the Human Rights of LGBTI Persons, called the decision historic, but expressed disappointment that opponents had succeeded in adding wording suggesting LGBI rights may be a cultural imposition.

“It diminishes very slightly something extraordinary that happened,” he said in an interview. “As we look at what motivates that kind of objection, it’s a misplaced fear that the intent of creating an independent expert is to condemn or criticize. All along, it was clear the dialogue is to be informative, a resource for all countries, including our own, to get better on LGBTI issues.”

The resolution was put forward not by the United States but by several countries in Latin America — Argentina, Brazil, Colombia, Chile, Costa Rica, Mexico, and Uruguay. Latin America has some of the world’s most advanced legal protections for gay and transgender people.

Though the resolution was being prepared before the June 12 massacre in a gay nightclub in Orlando, some human rights activists said they thought the mass shooting played a role in propelling the Human Rights Council resolution forward.

The U.N.Security Council condemned the Orlando shooting in a statement that made headlines because for the first time the body had specifically mentioned sexual orientation as a factor, saying 49 victims they had been targeted because of who they are.

“Orlando became part of the conversation around the resolution,” said Jessica Stern, executive director for Outright Action International, a U.S.-based human rights group. “I think it caused some governments on the fence to stop and take their decision much more seriously. You can’t keep your head in the sand after what happened at the Pulse nightclub.”

Under the resolution that passed, all the members of the United Nations are expected to cooperate with the expert, like the experts who already exist to investigate human rights abuses in countries or around themes. The countries are asked to facilitate the expert’s visits, and consider any recommendations that are made.

Shawn Gaylord, an advocacy counsel with Human Rights First, said the position has symbolic and practical value.

“It makes clear that LGBT rights are human rights,” he said. “That’s an essential part of the U.N. moving forward. On a practical level, there are resources that will flow and more staffing for LGBT issues to be researched, reviewed and recommendations made.”

Gaylord said an expert can find room for common ground, even in countries where gay and transgender people face social ostracism.

“If you’re talking about whether LGBT people should be protected from violence, a lot of countries would speak up for that,” he said. “Some countries are more challenging than others. But there’s always room for debate.”

Homosexual activities are illegal in 70 countries, 10 of which treat it as a capital offense.