Argentina's lawmakers on Wednesday night rejected a bill that would have legalized abortion in the country.

Thirty-eight lawmakers in the country's Senate voted against the bill, with 31 in favor and two obstaining.

The vote capped months of heated debate in the largely Catholic country and a massive rally the night of the vote which saw close to a million pro-abortion rights supporters gather outside the legislature, according to the Buenos Aires daily La Nación.

The bill would have allowed abortions during the first 14 weeks of pregnancy. Had the proposal been adopted, Argentina would have become the largest Latin American nation to legalize abortion, after Cuba. Abortion is currently legal only if the pregnancy is the result of sexual assault or if the mother's life is in danger.

ADVERTISEMENT

Supporters of the bill held protests for months under the banner of Ni Una Menos, a coalition of women's rights groups. Advocates for the bill noted that complications from clandestine abortions are the leading cause of maternal deaths in Argentina.

Hundreds of thousands of women demonstrated in the streets during Argentina’s winter to put pressure on President Mauricio Macri to bring the issue to a vote. The two sides figured prominently on social media, where they used the hashtags #AbortoLegalYa and #SalvemosLasDosVidas.

Macri has said he is personally opposed to abortion but allowed the debate.

The Catholic Church and Pope Francis, who was born in Argentina, pushed back.

In March, Francis sent a letter to the Argentine people urging them to “contribute to the defense of life and justice” as the abortion debate intensified.

Tensions ran high during the legislative debate — which lasted well into the morning — with some members of the lower chamber being barred from the Argentine Senate and the vice president hurling insults at a senator.

The question reached the Argentine Senate for the first time in history after the Chamber of Deputies, the lower legislative house, approved the measure in June.

Both sides in the debate drew support worldwide.

Amnesty International, a London-based human rights group, ran a full-page advertisement in the international edition of The New York Times on Tuesday depicting a clothes hanger to symbolize clandestine, unsafe abortions.

Margaret Atwood, author of “The Handmaid’s Tale,” also brought international attention to the debate with an op-ed likening the country’s anti-abortion laws to slavery.

“Enforce childbirth if you wish, Argentina, but at least call that enforcing by what it is. It is slavery,” Atwood wrote.

Argentine protesters dressed as handmaids from the book during rallies.

On the other side of the issue, U.S.-based organizations such as Live Action, Human Defense Initiative and the National Right to Life Committee expressed their opposition to the bill

The proposal cannot be brought up for debate until next year, but Argentina's Senate is set to discuss abortion again late this month when it considers reforms to the country's penal code, reported La Nación.

--Updated at 10:23 a.m.