Slideshow ( 6 images )

SANTIAGO (Reuters) - Chile’s Congress approved late on Wednesday night a bill that legalizes abortion in certain cases, though it will still need to win the approval of the nation’s courts to go into effect.

After a complex and fractious process, the nation’s Chamber of Deputies voted 70 to 45 to allow abortion when a woman’s life is in danger, when a fetus in unviable, or when a pregnancy results from rape.

It followed fierce debate and a razor-thin vote to approve the bill in the nation’s more conservative Senate in July, and a previous debate in the Chamber of Deputies which sent a slightly different version of the original bill to the Senate last year.

Chile is one of only a handful of countries worldwide where abortion is illegal without exception. The ban was put in place during the closing days of Augusto Pinochet’s 1973 to 1990 dictatorship, and current center-left President Michelle Bachelet pledged reform when she took office in 2014.

“Today we are signing a text that is returning liberty to women,” said Senator Felipe Harboe, of the center-left Party for Democracy. “There is no woman who would be happy finding herself in one of these three situations, but there is no man who has the right to make her suffer.”

All eyes now will turn to Chile’s Constitutional Tribunal, which will decide in the coming weeks on the legality of the new laws.

It is not clear when exactly the matter will be tried by the Constitutional Tribunal. The body’s current center-left president is set to be replaced by a conservative jurist on Aug. 29. Should the bill be litigated after that period, analysts say, the chances of it being struck down increase.

“We’re going to allege (in the court) that the project violates the right to life,” said Senator Juan Antonio Coloma of the right-wing UDI party.