BUENOS AIRES — Argentina’s Senate on Thursday narrowly rejected a bill to legalize abortion, dealing a stinging defeat to a grass-roots movement that pushed reproductive rights to the top of the country’s legislative agenda and galvanized women’s groups throughout Latin America.
The lead-up to the vote gripped the nation as opposing camps fought to sway undecided senators until the final hours. As senators debated the bill for more than 16 hours, thousands of advocates on both sides gathered outside Congress, and the Roman Catholic Church held a “Mass for Life” at the Buenos Aires Metropolitan Cathedral.
Proponents of the bill — which would have allowed abortions during the first 14 weeks of pregnancy — had hoped Argentina would begin a sea change in reproductive rights in a largely Catholic region where 97 percent of women live in countries that ban abortion or allow it only in rare instances.
Thirty-eight lawmakers voted against the bill, 31 voted in favor of it and two abstained.
Just weeks ago, the abortion-rights campaigners appeared to have a good chance of success, stunning opponents. But opposition hardened as Catholic Church leaders spoke out forcefully against abortion from the pulpit and senators from conservative provinces came under intense pressure to stand against the bill.
“This bill did not solve anything,” Senator Olga Inés Brizuela y Doria said after the vote. “We have to go to the causes of abortion and not abortion as a solution.”
As soon as the voting result was announced, fireworks started going off on the anti-abortion side of the plaza outside the Congress building. Shortly after, a few protesters in support of abortion rights lit fires and threw rocks at the building and gathered police officers. The clashes were short-lived, but local reports mentioned an unspecified number of detentions.
Argentines from both camps had waited outside for much of the night as the senators debated and voted, wearing handkerchiefs that indicated their feelings toward the bill — green for its passage, blue against.
“We knew it wasn’t going to pass, but we felt we had to be here anyway to make our presence felt,” said Jimena Del Potro, a 33-year-old designer with a green handkerchief around her wrist who fought back tears as she spoke. “We will no longer be silent and we won’t let them win. Abortion will be legal soon. Very soon.”
María Curutchet, a 34-year-old lawyer with a blue handkerchief around her neck, had a wide smile on her face despite spending almost eight hours in the cold of winter to express her opposition to abortion.
“It was a very emotional day,” she said. “We were out in huge numbers and showed that we will defend the two lives, no matter the cost.”
While the proposal’s defeat was considered a major setback for the grass-roots activists who backed it, analysts said the movement’s improbable rise had already begun to change the region in ways that would have been impossible just years ago.
“Abortion rights was a priority and it will be deeply discouraging to have come this far and fail,” said Benjamin Gedan, an Argentina expert at the Woodrow Wilson International Center for Scholars. But he said women’s rights advocates had already had successes.
The Argentine campaign is credited with inspiring debate on a variety of women’s issues — including domestic violence — in a socially conservative region where such subjects have long been taboo. In Argentina, activists scored a victory with the passage of a law that seeks to have an equal number of male and female lawmakers.
“If we make a list of the things we’ve gained and the things we’ve lost, the list of things we’ve gained is much bigger,” said Edurne Cárdenas, a lawyer at the Center for Legal and Social Studies, a human rights group in Argentina that favors legalized abortion. “Sooner or later, this will be law.”
In the region, only Uruguay, Cuba, Guyana and Mexico City allow any woman to have an early-term abortion. But inspired partly by the campaign in Argentina, people in other places are pushing to expand reproductive rights.
In neighboring Brazil, activists this month urged the Supreme Court to rule that the country’s abortion restrictions, which are similar to Argentina’s, are unconstitutional.
A bid to permit abortion under some circumstances in El Salvador, where it is entirely banned, foundered in April after lawmakers decided not to vote on two bills before them. Advocates in Chile, meanwhile, have been fighting to expand abortion rights, building on last year’s partial legalization.
For Argentina, the debate over abortion has tugged at the country’s sense of self.
It is the birthplace of Pope Francis, the leader of the world’s Catholics, who recently denounced abortion as the “white glove” equivalent of the Nazi-era eugenics program.
But the country in recent years has inched away from a close church-state relationship.
In 2010, Argentina became the first country in Latin America to allow gay couples to wed — a move the church fought with a vigor similar to its battle against abortion, organizing protests involving thousands of people. Francis, then the archbishop of Buenos Aires, called that bill a “destructive attack on God’s plan.”
The fight over abortion divided the political class and forced leaders to grapple with their personal and political convictions. President Mauricio Macri, a center-right leader who opposes legalized abortion, told allied lawmakers to vote their conscience and said he would sign the law if it was approved by Congress.
Some prominent female political leaders came out publicly against the measure, including Vice President Gabriela Michetti.
But Mr. Macri’s health minister, Adolfo Rubinstein, testified in Congress in favor of legalization and has estimated that some 354,000 clandestine abortions are carried out every year in the country. Complications as a result of those abortions are the single leading cause of maternal deaths in the country, according to Mariana Romero, a researcher at the Center for the Study of the State and Society, a nonprofit organization.
The grass-roots movement that pushed the bill started in 2015 with the brutal murder of a pregnant 14-year-old girl by her teenage boyfriend. Her mother claimed the boyfriend’s family didn’t want her to have the baby.
As debates about violence against women on social media grew into wider conversations about women’s rights, young female lawmakers gave a fresh push to an abortion bill that had been presented repeatedly in the past without going anywhere.
In June, the activists scored an unexpected victory when the lower house of Congress narrowly approved a bill allowing women to terminate pregnancy in the first 14 weeks. Current law allows abortions only in cases of rape or when a mother’s life is in danger.
While the measure failed in the Senate, it made some inroads. Among the senators who voted for it was Cristina Fernández de Kirchner, who as president had opposed legalizing abortion.
“The ones who made me change my mind were the thousands and thousands of girls who took to the streets,” she said before the vote early Thursday. “This law will not be approved tonight, but I want to tell everyone that if it’s not this year, it will be next year or the following.”
Daniel Politi reported from Buenos Aires, and Ernesto Londoño from New York.