– Ireland has become the first nation to approve same-sex marriage by a popular vote, sweeping aside the opposition of the Roman Catholic Church in a resounding victory Saturday for the gay rights movement and placing the country at the vanguard of social change.

With the final ballots counted, the vote was 62 percent in favor of legalizing same-sex marriage, and 38 percent opposed.

The turnout was large — more than 60 percent of the 3.2 million eligible voters cast ballots, and only one district out of 43 voted the measure down.

Cheers broke out among the crowd of supporters who had gathered in the courtyard of Dublin Castle when Returning Officer Riona Ni Fhlanghaile announced around 7 p.m. that the ballot had passed 1,201,607 votes to 734,300.

Not long ago, the vote would have been unthinkable. Ireland only decriminalized homosexuality in 1993, the church dominates the education system and abortion remains illegal except when a woman’s life is at risk. But the influence of the church has waned amid scandals in recent years, while attitudes, particularly among the young, have shifted.

“Today Ireland made history,” Prime Minister Enda Kenny said at a news conference, adding that “in the privacy of the ballot box, the people made a public statement.”

“This decision makes every citizen equal, and I believe it will strengthen the institution of marriage,” Kenny said.

The vote is also the latest chapter in a sharpening global cultural clash. Same-sex marriage is surging in the West, legal in 19 nations before the Irish vote and 37 U.S. states, but almost always because of legislative or legal action. At the same time, homosexuality is illegal across much of the Middle East, and gay rights are under renewed attack in Russia and parts of Africa.

The results showed wide and deep support for a measure that had dominated public discourse and dinner-table conversation in the months before the vote Friday. Supporters celebrated in gatherings and on the streets, with the rainbow colors of the gay rights movement and Yes vote buttons conspicuously on display.

Surprising many who had predicted a generational divide, the support cut across age and gender, geography and income, early results showed.

With early vote counts suggesting a comfortable victory, crowds began to fill the courtyard of Dublin Castle, a government complex that was once the center of British rule. By late morning, the leader of the opposition, David Quinn, director of the Iona Institute, conceded the outcome on Twitter: “Congratulations to the Yes side. Well done.”

For older activists, the moment marked a profound evolution for their country. For the world, it suggested how far the gay rights movement has come, to make such a significant step in a country with a storied history as a religious stronghold.

“Throughout my youth, adolescence and young adulthood, it was a criminal offense to be gay,” said David Norris, a 70-year-old Irish senator and longtime activist.

“There was silence on the subject,” he said. “It wasn’t mentioned in the newspapers, it wasn’t mentioned in the broadcast media. Then there was a fear of criminal prosecution, of being involuntarily placed in a lunatic asylum, losing your job, being socially destroyed. It was a terrible situation.”

The referendum changes Ireland’s Constitution so that civil marriage between two people is now legal “without distinction as to their sex.” It requires ratification by both houses of the Irish Parliament and the president. Though that is a formality, the date when gay and lesbian couples can marry will be determined in that process.

Many placed the results in a national context, saying it pointed not only to change but also to the compassion and tolerance of the Irish people.

Alex White, the government’s minister for communications, said: “This didn’t change Ireland — it confirmed the change. We can no longer be regarded as the authoritarian state we once might have been perceived to be. This marks the true separation of church and state.”