Polish lawmakers voted down a complete ban on abortions on Thursday, handing a victory to tens of thousands of men and women who had protested the proposal in recent days.
Lawmakers rejected the bill in a 352 to 58 vote during a hastily convened session of parliament, with 18 lawmakers abstaining.
The legislation, which had been proposed by a grassroots citizens movements, would have banned abortions even in cases where a woman's life was threatened or the child had been conceived by rape.
It also included the possibility of five years in jail for women who received abortions and their doctors.
It had been initially supported by the ruling right-wing Law and Justice Party (PiS) but the party reversed its postion after the mass protests and international condemnation.
"We must respect different opinions on the issue," Prime Minister Beata Szydlo said after the vote.
Perhaps the most controversial aspect of the proposal was the threat of jail time, with even the powerful Catholic Church drawing back from its early unequivocal support over the issue.
"To punish women was never our intent," said Ryszard Terlecki, the Law and Justice Party leader in parliament.
Tens of thousands of men and women protested the proposal in Warsaw on Monday.
The centre-left Civic Platform party claimed victory following the bill's defeat, with former prime minister Ewa Kopacz saying: "Freedom and the right to self-determination have been won."
The bill was approved by a parliamentary committee in its first reading at the end of September but then rejected in its second on Wednesday, forcing the full parliament to consider the bill on Thursday.
Poland's current laws on abortions, among the strictest in Europe, allow abortions only in case of rape, when the life of the mother is in danger, or in the case of severe disability of the child.
According to official figures, up to 1,000 pregnancies are aborted in Poland every year, although women's rights activists believe the true figure could be 150 times that.