BUENOS AIRES, Argentina — Argentina’s Senate passed a law legalizing abortion in Pope Francis’ homeland early Wednesday after a marathon 12-hour session, a victory for the women’s movement that has been fighting for the right for decades.

The vote means that abortion will be legalized up to the 14th week of pregnancy, and also will be legal after that time in cases of rape or danger to the mother’s life. It will have repercussions across a continent where the procedure is largely illegal.

MASSACHUSETTS LOWERS AGE FOR ABORTION WITHOUT PARENTAL CONSENT

The measure was passed with 38 votes in favor, 29 against and one abstention, after a session that began late Tuesday.

Nuns attend a demonstration against the decriminalization of abortion as lawmakers debate its legalization, outside Congress in Buenos Aires, Argentina, Tuesday, Dec. 29, 2020. (AP Photo/Marcos Brindicci)

It was already approved by Argentina’s Chamber of Deputies and has the support of President Alberto Fernández, meaning the Senate vote was its final hurdle.

TRUMP ADMINISTRATION BLOCKS FUNDING FOR CALIFORNIA, BRINGS DOJ SUIT OVER ABORTION ISSUES

"Safe, legal and free abortion is now the law," Fernández tweeted after the vote, noting that it had been an election pledge.

"Today, we are a better society that expands women’s rights and guarantees public health," he added.

Argentina is the largest Latin American country to legalize abortion and the vote was being closely watched. With the exceptions of Uruguay, Cuba, Mexico City, Mexico’s Oaxaca state, the Antilles and French Guiana, abortion remains largely illegal across the region.

Outside the Senate, pro- and anti-abortion rights activists gathered, with the bill’s supporters wearing the color green that represents their abortion rights movement. Backers waved green flags as Vice President Cristina Fernández de Kirchner, who presided over the debate, announced the result, shouting "legal abortion in the hospital" as the measure was passed.

CLICK HERE TO GET THE FOX NEWS APP

Argentina until now has penalized women and those who help them abort. The only exceptions were cases involving rape or a risk to the health of the mother, and activists complain even these exceptions are not respected in some provinces.

Just hours before the Senate session began Tuesday, the pope weighed in, tweeting: "The Son of God was born an outcast, in order to tell us that every outcast is a child of God. He came into the world as each child comes into the world, weak and vulnerable, so that we can learn to accept our weaknesses with tender love."

Abortion-rights activists watch live video streaming of lawmakers in session, outside Congress in Buenos Aires, Argentina, Wednesday, Dec. 30, 2020. Congress approved a bill that legalize abortion in Argentina. (AP Photo/Natacha Pisarenko)

A previous abortion bill was voted down by Argentine lawmakers in 2018, but this time it was backed by the center-left government. The outcome of the latest vote, however, had still been considered uncertain. That was partly due to the fact that the political parties, including the governing Peronist movement, gave their legislators freedom to vote as they chose. Two of the 72 senators were absent, and 43 of the remaining 70 senators were men.

Argentina’s feminist movement has been demanding legal abortion for more than 30 years and activists say the bill’s approval could mark a watershed in Latin America, where the Roman Catholic Church’s influence has long dominated.