After an all-night debate,129 members of the chamber of deputies voted in favour and 125 against.

The lower house of Argentina’s Congress on Thursday narrowly passed a bill to legalise abortion through 14 weeks of pregnancy after a tight vote on a proposal that has divided the South American nation.

The proposed legislation would allow abortion in the first 14 weeks of pregnancy, and beyond that in cases where the foetus suffers from conditions not compatible with life outside the womb.

After an all-night debate,129 members voted in favour and 125 against. The bill will now go to the Senate.

“We are dealing with a public health issue that cannot be addressed with blinders, nor with morals and ethics and much less religion,” opposition congresswoman Mayra Mendoza, one of the driving forces of the proposal, said in a speech.

“This is also a matter of social justice.”

The Catholic Church opposes the initiative, with Cardinal Mario Poli saying that “the foremost duty of a state is to protect the life of its inhabitants.”

The opposition, as well as allies of President Mauricio Macri, were divided.

Macri has encouraged his party members to vote as they see fit even though he is personally opposed to the proposal.

“Today, Argentina has committed to make significant progress in defending the human rights of women and girls, and is also sending an important message to the rest of the continent, where restrictive laws on accessing safe and legal abortions have caused death and suffering for millions of women and girls,” said Erika Guevara-Rosas, Americas Director at Amnesty International.

New legislation

The law would also allow doctors to refuse to perform abortions if they so wish. Girls between ages 13 and 16 would need permission from an adult to receive an abortion.

Argentina, like most countries in Latin America, currently permits abortion in specific cases, including rape and risk to the mother’s life.

Rights groups have criticised a requirement for a judge’s permission, which often results in lengthy delays or denial of the procedure.

The bill emphasises the danger Argentine women face in seeking clandestine abortions, particularly poor women. A letter signed by several social organisations and human rights groups urged legislators “not to turn their backs on women.”

More than 60 percent of Argentinians – especially young people – are in favour of legalizing abortion, according to a poll by the social sciences faculty of the University of Buenos Aires.

An estimated 500,000 unsafe abortions are performed annually in the South American country.

Argentina recorded 245 cases of maternal mortality in 2016, according to official figures quoted by the website Infobae. Of these, 43 were due to abortions or miscarriages.