MEXICO CITY — In Mexico’s modernizing capital, the word these days seems to be “keep calm, and marry on,” a nonchalance toward gay marriage that’s slowly catching on across Latin America.

Pushing that message, Mayor Miguel Angel Mancera stood witness recently to the mass wedding of 58 lesbian and gay couples, who said their vows in unison.

"This is one more event in ... the city of freedoms,” Mancera, who presided over a similar ceremony in July, told the 74 women and 42 men taking the plunge. Mexico's capital is “a city that is concerned about and working on moving ahead,” he said.

The latest gay nuptials took place at a museum just blocks from Mexico City’s central plaza — and from the cathedral pulpit of Cardinal Norberto Rivera, who has railed against gay unions as “perverse” affronts to Mexican families and the “divine project.”

But this city’s left-leaning government has been poking the eyes of Catholic leaders and other cultural conservatives for more than a decade now. Promoting diversity — sexual, political, religious — is official policy here. The Mexican capital in many ways has set the pace of social change across Mexico and the region.

Mancera told the newlyweds at the March 21 mass wedding the city is determined to push equality issues "step by step." He announced an initiative to make it easier for people to legally change their gender.

Mexico City legalized gay marriage in late 2009. Less than a year later, the country’s Supreme Court ruled that the rest of the nation must recognize those marriages.

That said, same-sex unions remain illegal in most of Mexico. As in the United States, the federal system here leaves the definition of marriage up to state legislators, or the municipal council in the case of Mexico City’s federal district.

But advocates in the past year have won court rulings forcing recognition of gay marriages in several states on a case-by-case basis. Those decisions give activists hope that judges can nudge state governments toward recognizing marriage equality.

“We have advanced very quickly,” said lawyer Luis Guzman, 33, a leading activist in the conservative western city of Guadalajara who married his long time companion in one of Mexico City's first gay weddings. “These four years have been very important to us.”

“The courts are the easiest way to do it,” Guzman said. “The local legislatures don't want to touch the issue.”

Despite enduring discrimination, courts and congresses are changing laws and attitudes toward gay rights elsewhere in Latin America.

“There has been a gay rights revolution that has stretched from Tierra del Fuego to the Rio Grande," Omar Encarnacion, a political scientist at Bard College in New York, noted on a recent blog post in The New York Times.

Well, perhaps not quite a revolution.

The culture clash over gay unions regionwide has been at least as fraught as that in the United States. With gay equality entwined here with a growing awareness of human rights of every kind, courts and activists across the region have been prodding reluctant lawmakers and societies alike.

Many societies remain outright hostile to same-sex couples, as GlobalPost’s Simeon Tegel reported last year. And violence stalks gays throughout the region.

“There are some advances, but they are hand in hand with backlash,” says Maria-Mercedes Gomez, Latin America coordinator for the New York-based International Gay and Lesbian Human Rights Commission.

“We still have a long, long way to go, still far from a heavenly situation on human rights.”

Yet Latin America provides three of the 17 countries that have legalized gay marriage worldwide. The Argentine capital Buenos Aires started the charge allowing same-sex marriage in November 2009. Argentina's congress legalized it nationally in 2010 and Uruguay's did so last spring.

Bypassing legislators, a Brazilian judicial panel ruled last year that gays could not be denied marriage licenses, effectively legalizing the unions. The ruling is being challenged and congress may yet rescind or modify it.

Some form of civil union are legal in Colombia and Ecuador. Chile's lower congressional chamber currently is debating a senate-approved “life partnership agreement,” a form of civil union.

Outside Mexico City, gay marriages have been recognized as legal since 2011 in Quintana Roo, the state on the Caribbean coast of the Yucatan Peninsula that includes Cancun.

Three other states, including Jalisco, of which Guadalajara is the capital, allow civil unions. A federal court in late 2012 ruled that Oaxaca state's vague legislation rendered the marriages of three gay couples legal.

“We are recognizing realities," said Hector Maldonado, director of Mexico City's Civil Registry, which records marriages. "This is a defense of the freedom of expression, the freedom to love.

"The changes here make it clear that people have to push for their rights," he said. "Now they have to push it in the states as well."

Such attitudes remain well ahead of the average citizens. But one nationwide poll revealed last year that a slight majority of Mexicans now at least don’t opposed gay marriage or civil unions.

Public attitudes in part are shaped by religious leaders, which despite Pope Francis’ more conciliatory language, in Mexico have been almost uniformly hostile to same-sex unions in Mexico.

"Truly Mexico is suffering a lot of bad things, flu, violence, poverty, unemployement and together with these comes news of a bad and perverse law," Rivera, Mexico's highest-ranking Catholic clergyman, said when the gay marriage law was passed.

When the Supreme Court ruled that the capital’s marriages are valid nationwide, the prelate said that "de facto or supposedly legal unions between persons of the same sex are immoral, as they contradict the divine plan."

But, at least in key parts of the capital and other big cities, public opinion seems to be steadily shifting toward acceptance.

Mexico City's gay pride parade each June draws tens of thousands of marchers and thousands more spectators, including many families.

Gay men at times seem to own the Zona Rosa, or Pink Zone, which until the capital's disastrous 1985 earthquake was the city’s nightlife mecca.

Smooching same-sex couples have become common on the street and subway, where gay men often gravitate to the last car of the trains, far outnumbering straight riders.

Such public displays of affection seldom draw stares in this city of 9 million, even more rarely a public rebuke.

“It depends of course upon what part of the city you are in,” said Samuel Villanueva, a 29-year-old sales clerk, who strolled with his veterinarian partner through a recent lunchtime throng in the Zona Rosa, their arms across the small of one another's back.

“But there isn't so much discrimination any more,” Villanueva said. “There are gays in every family, in every neighborhood. People are starting to realize and accept that.”