A Chilean court dealt abortion rights activists a landmark victory Monday, approving a controversial bill that rolled back parts of one of the world's strictest abortion bans.

The bill passed by lawmakers earlier this month — after a years-long campaign by President Michelle Bachelet — added three exceptions to a law that for nearly three decades outlawed abortion in all cases. By a narrow margin, lawmakers rendered abortion legal when the pregnancy results from rape, when the pregnancy endangers the mother's life and when the fetus is unviable.

Yet the bill remained in doubt for weeks afterward as its opponents lodged a complaint with the country's Constitutional Court, which weighs in on disputes over a potential law's constitutionality. As The Two-Way reported, the bill's conservative opposition filed a 67-page document arguing that the bill failed to fulfill the constitution's requirement to "protect the life that is about to be born."

On Monday, after several days of deliberation and the input of more than 130 groups, the court ruled 6-4 that the bill complied with the constitution.

Bachelet hailed Monday as a "historic day for the women of Chile!" With the court's ruling in favor of the bill — which has now become law — she tweeted, "we advance a basic right for our dignity."

Bachelet, a center-left politician and former chief of U.N. Women, has long made the fight to relax the country's abortion ban a centerpiece of her legislative agenda. Yet while roughly 70 percent of Chileans supported her measure, conservative resistance in the predominantly Catholic country was steep.

The full abortion ban had been in place since dictator Augusto Pinochet implemented it near the end of his reign. Pinochet's law had made Chile one of just a handful of countries worldwide to outlaw the procedure without any exceptions.

Still, as the BBC notes, that did not prevent abortions from being conducted. The news service reports up to 70,000 illegal abortions took place annually in Chile, often with the aid of pills obtained on the black market.

"Chile has finally moved one step closer to protecting the human rights of women and girls," said Erika Guevara-Rosas, Americas director at Amnesty International, in a statement.

Copyright 2017 NPR. To see more, visit http://www.npr.org/.