A Yes voter poses with a badge as votes are counted in the Irish abortion referendum on May 26. (Paul Faith/AFP/Getty Images)

— The Irish have swept aside one of the most restrictive abortion bans in the developed world in a landslide vote that reflects Ireland’s emergence as a socially liberal country no longer obedient to Catholic dictates.

With all ballots counted and turnout at a near-historic high, election officials reported Saturday that 66.4 percent voted to overturn Ireland’s abortion prohibition and 33.6 percent opposed the measure.

The outcome of the referendum Friday was a decisive win for the campaign to repeal the Eighth Amendment to the Irish Constitution. The 1983 amendment enshrined an “equal right to life” for mothers and “the unborn” and outlawed almost all abortions — even in cases of rape, incest, fatal fetal abnormality or non-life-threatening risk to maternal health.

“What we have seen today is a culmination of a quiet revolution that has been taking place in Ireland for the past 10 or 20 years,” Prime Minister Leo Varadkar said.

The turnout was a 64.1 percent — the third-highest for a referendum vote since the adoption of the constitution in 1937 and the decision to join the European Economic Community in 1972. By comparison, turnout was just over 60 percent when Ireland voted to legalize same-sex marriage in 2015.

Ireland’s political leadership promised that Parliament will quickly pass a new law guaranteeing unrestricted abortion up to 12 weeks and beyond that in cases of fatal fetal abnormalities or serious risks to a mother’s health. That would bring Ireland’s access to abortion in line with the other 27 members of the European Union.

In Ireland, seeking or providing an abortion has been punishable by up to 14 years in prison. Since 2013, there has been an exception for when a mother’s life is at risk.

Varadkar, who is gay and whose right to marry was accepted in Ireland only three years ago, called the vote a turning point.

“It’s also a day when we say no more,” the prime minister said. “No more to doctors telling their patients there’s nothing can be done for them in their own country, no more lonely journeys across the Irish Sea, no more stigma as the veil of secrecy is lifted and no more isolation as the burden of shame is gone.”

Simon Harris, Ireland’s minister of health, said a bill would be written this summer and passed by year’s end. “The people of Ireland have told us to get on with it,” he said.

Harris said he was as surprised as anyone with the high turnout and outsize vote for repeal. “If you can find anybody today who said they were expecting this majority, I’d love to meet them. I don’t think anybody was expecting this margin,” he said.

Campaigners for repeal, watching the votes being counted in auditoriums around Ireland, were giddy with news of a landslide.

In Dublin constituencies, the vote topped 75 percent for repeal.

Even in elderly, traditionally conservative Roscommon- ­Galway, the only constituency to reject same-sex marriage in the 2015 referendum, the “yes” vote for overturning the abortion ban was 57 percent.

Exit polls released by Irish broadcaster RTE and from the Irish Times found women out­polled men, but men still supported the yes side. So did farmers and rural counties. Support was largest among the young and urban.

Of the Republic of Ireland’s 26 counties, only Donegal in the far northwest voted down the repeal.

Irish Times columnist Finan O’Toole tweeted: “For all the attempts to divide us into tribes, the exit poll shows that every part of Ireland has voted in broadly the same way, which is to trust women and make them fully equal citizens.”

Katherine Zappone, Ireland’s minister for children and youth affairs, said the result made her very emotional. “I’m especially grateful to the women of Ireland who came forward to provide their personal testimony about the hard times that they endured, the stress and the trauma that they experienced because of the Eighth Amendment,” she said.

But John McGuirk, a leader of prominent antiabortion group Save the 8th, called the vote “a tragedy of historic proportions.”

On Facebook, McGuirk’s organization posted, “Abortion was wrong yesterday. It remains wrong today.” The group said it would fight the legislation. 

Cora Sherlock, another prominent antiabortion campaigner, vowed in a tweet: “The struggle to defend the most vulnerable has not ended today, it’s just changed.”

Although Ireland bans abortion, it does not restrict travel for it. Researchers estimate that about 3,500 women make the trip to Britain each year and that another 2,000 end their pregnancies with pills they buy over the Internet and smuggle into Ireland.

A central figure in Ireland’s abortion debate has been Amanda Mellet. In 2011, Mellet was forced to choose between carrying a dying fetus to term in Ireland or to travel abroad for an abortion.

In June 2016, the United Nations Human Rights Committee found Ireland subjected Mellet to cruel, inhuman or degrading treatment, while also violating her right to privacy. The U.N. decision required Ireland, for the first time, to compensate a woman for the expenses and emotional distress tied to an abortion.

Many saw the vote as a blunt rebuttal to the Catholic hierarchy, which has been beset by scandals over sexual abuse, financial crimes and its historic treatment of women.

“I’m so happy. I’m feeling ecstatic, and to be honest, I didn’t think it would happen like this, not in such a big way,” said Amy Dwyer, 31, a Dublin writer. She was standing in the drizzle at Dublin Castle alongside a thousand others waiting for the last few ballot boxes to be counted.

Social change in Ireland has been profound. In the 1990s, homosexual activity was criminal here. Divorce was forbidden. It was still difficult to buy a condom, the sale of which was outlawed until 1985. Within a generation, all of that has changed. In 2015, the majority-Catholic nation of about 4.8 million people was the first country to legalize same-sex marriage by referendum.

“I’ve gone from being a criminal to being able to marry a man,” said David Norris, a scholar of James Joyce credited with leading the campaign to overturn Ireland’s anti-gay-sex statute in 1993.

Beginning with the issue of contraception in the 1960s, public opinion began to veer from the teachings of the Catholic Church — as the pope reaffirmed the prohibition on birth control against the recommendations of a commission composed of theologians, physicians and others. 

“That affected people’s real sexual and reproductive lives,” Norris said. “The majority of people just ignored the teachings of the church.” But “the nail in the coffin,” he added, was “the succession of really appalling scandals about mistreatment of women and molestation of children.”

Outrage over clerical abuse compounded doubts about religious authority, said Gladys ­Ganiel, a political sociologist at Queen’s University Belfast. People did not cease identifying as Catholic, or believing in God, but became more comfortable following their own conscience over church dictates.

The European Values Study found in 2008 that 92 percent of Irish people believed in God, representing a drop of only 5 percent since 1981. Still, the share of the population identifying as Catholic has diminished markedly, from 92 percent in 1991 to 78 percent in 2016, according to census data.

Ganiel said economic changes, combined with eventual loosening of laws on the sale of contraceptives, undermined an alliance between priests and mothers that was central in maintaining Irish conservatism. 

“This begins in the 1960s, but somebody stood on the accelerator in the 1990s when things started coming out about church abuse,” Ganiel said. “The 1990s are also when Ireland becomes economically prosperous for the first time. It’s a perfect storm. Religious authority declines in Ireland from a much higher peak than the rest of the world. It’s quite dramatic, but with hindsight, it’s not as unexpected.”

Daithí Ó Corráin, a historian at Dublin City University, said familiar patterns have transformed the role of religion in Irish society — including urbanization, greater education and generational differences.

“Ireland is just a very different country now than it was in 1983,” he said, referring to the year in which the Eighth Amendment was endorsed by 67 percent of voters. “I suppose after contraception, after divorce, after marriage equality, this — legal abortion — really is the last bastion.”