The United Nations announced Monday it would recognize the gay marriages of all its staffers, in a major policy shift that opens the door for the spouses of homosexual employees to enjoy the same benefits as the husbands and wives of their heterosexual colleagues.

Previously, the United Nations only recognized the unions of staffers who came from countries where gay marriage is legal. Now anyone who marries in countries where gay marriage is legal is included.

The change means gay spouses of UN employees can get health insurance coverage and the chance to accompany spouses on their home leave every couple of years, among other benefits.

For Anna Guerraggio, an Italian citizen who works at the UN in New York, this means the certainty that she can now be joined by her girlfriend of five years without worrying about visas or immigration issues, or waiting for her partner, Flaminia De Agostini, to hear whether she got a job with a visa.

"If she doesn't get the job, then we get married and she benefits from my visa," Guerraggio said in a telephone interview from Italy, which doesn't recognize gay marriage.

UN-Globe, a group representing LGBT staffers at the UN, had pushed for the UN to recognize gay staffers' marriages since 1997. It welcomed Monday's announcement as a massive step forward.

"Too many of us have suffered under the previous policy. Too many of us have been unable to secure, for example, residency visas and health benefits for our spouses because of a discriminatory policy that would refuse to recognize our legal partners," the group's president, Hyung Hak Nam, said in a statement. "Let us just enjoy this moment, this huge victory."

The new policy, led by Secretary-General Ban Ki-moon, became effective June 26, and will impact the UN's approximately 43,000 employees worldwide. Employees of separate UN agencies, such as the children's agency UNICEF and the UN cultural agency UNESCO, also are affected by the change, UN deputy spokesman Farhan Haq said.

Ban has been an outspoken supporter of gay rights, openly denouncing homophobia in speeches around the world. He notably did so in Sochi, Russia, just before the opening of the Winter Olympics, when he condemned attacks and discrimination against homosexuals. The speech came at a time when activists and protesters had stepped up their campaign against Russia's law restricting gay rights activities.

"For a couple of years, the secretary-general has boldly spoken about equality for all people, and now he was bold enough to do it," Guerraggio said. "He is defending his own employees, and we appreciated that."

According to the Pew Research Center, gay marriage is legal in 18 countries, plus parts of the United States and Mexico. But prejudice remains deep in many countries. An extreme case is Uganda, which in February passed a law making gay sex punishable by a life sentence.