Buenos Aires, Argentina — Argentine lawmakers were deliberating into the evening Wednesday on a landmark bill to broadly legalize abortion, as the country became South America’s latest battleground over the long-taboo procedure.

The vote was taking shape at a time when countries in the heavily Catholic region are re-examining the issue and considering expanding access to abortion. In Argentina, the vote in the upper house was the culmination of a months-long debate in a nation deeply divided over the practice.

As the Senate session stretched on, however, passage of the law appeared less and less probable. In public statements, 38 of the 72 senators have expressed some form of opposition, while 31 have voiced their intention to back it. Outside the building, members of the campaign for legalized abortion maintained a measure of confidence. Some recalled that the situation looked bleak for them in June, when the lower house seemed to be leaning toward rejecting the bill, only to ultimately pass it.

“Right now, we don’t have the votes,” said Clara Noceti, a member of the Network of Health Professionals for the Right to Decide. “But we’re hoping such a big turnout [of supporters] will change the minds of some senators.”

Other advocates, as well as some senators, began floating the idea of revising the bill and sending it back to the lower chamber.

Argentine law permits abortion in the case of rape, when the mother is mentally disabled or if there is serious risk to her health. Seeking an abortion for any other reason can land a woman in prison for as long as four years. Experts say the restrictions have forced thousands of women each year to seek risky, clandestine procedures, many of which are performed in unsanitary conditions by unlicensed practitioners.

Health professionals involved in such operations also can go to prison for as long as six years.

In contrast, the new bill would allow girls as young as 13 to terminate a pregnancy for any reason within the first 14 weeks. The legislation would also require that abortions be carried out within five days of the mother’s request.

On Wednesday, supporters and opponents rallied outside Congress ahead of the vote, separated by riot fences and police. Those in favor waved green banners and formed drum circles. Those against bore the light blue of the Argentine flag, and some carried a giant, cardboard fetus.

Thousands of antiabortion advocates, sometimes from the most distant provinces of the country, arrived in Buenos Aires over the weekend.

“God gave us life,” Anto Sosa, 33, of Entre Rios, said during a Saturday rally. “And trying to eliminate a life as the first solution — it’s not right.”

Argentina is the latest nation in South America to grapple with the legalization of abortion. In 2012, Uruguay decriminalized it. Last year, lawmakers in Chile approved legislation legalizing abortion under limited circumstances. Last week, Brazil’s supreme court also began considering decriminalization, prompting impassioned debate and protests.

As the Argentine bill has made its way through Congress this year, its advocates have flooded the streets of the capital, as well as other major cities. But away from the more left-leaning urban parts of Argentina, opposition to the bill has run deep.