Argentina's senate has rejected a bill which would have legalised abortion in the first 14 weeks of pregnancy.
After a marathon debate, 38 senators voted against it and 31 in favour. Its defeat means lawmakers must wait until next year to resubmit legislation.
Currently abortion is allowed in Argentina only in cases of rape, or if the mother's health is in danger.
Demonstrators on both sides of the debate rallied outside parliament as voting took place.
Anti-abortion activists have been jubilant. "It's a joy to see that our society can be based on such an important principle as the defence of the most defenceless, the child," said one.
Pro-choice campaigners say they are not giving up. Some started fires and lobbed missiles at police after the vote.
How did we get here?
Pro-choice campaigners have for years tried to get bills passed in Argentina, where the population is overwhelmingly Roman Catholic.
Their efforts gained new impetus when President Mauricio Macri - who opposes abortion - called on Congress to consider a vote on it, and it narrowly passed in the lower house.
However, with the Senate leaning conservative, the bill's passage always looked difficult. Among the 30 women in the chamber, the vote was evenly split.
The debate lasted more than 16 hours in an often fraught session.
*Argentine Vice-President Gabriela Michetti, who also opposes abortion, was heard swearing at colleagues without realising her microphone was on.
*One pro-choice Senator, Pedro Guastavino, said he had been lobbied heavily by the Catholic Church, saying he had had to "dodge crucifixes"
*Senator Rodolfo Urtubey, who opposed the bill, sparked controversy by suggesting rape inside marriage did not conform to the "classic" definition of rape because - in his view - it did not always involve violence.
He later said he had been misinterpreted.
*Former President Cristina Fernández de Kirchner, who is now a senator and who had refused to back the legalisation of abortion while president, supported the bill, saying her mind had been changed by the thousands who took to the streets.
Campaigners in their own words
"This law doesn't obligate, nor does it recommend anyone have an abortion. The only thing this law does is defend the right to choose." Norma Durango, from the opposition Peronist party
"The message that we wanted to put across is that abortion equals social failure. For a woman to resort to it, many other things need to have failed first." Camila Duro of the anti-abortion non-governmental organisation Frente Joven
"Women perform abortions with criminalisation or without it." Sabrina Cartabia Groba, pro-choice lawyer and campaigner
"Abortion always kills a child and it doesn't solve the woman's problem. We believe that this is never the solution. Faced with an unexpected pregnancy abortion is never the solution. There are always other solutions." Maria Castillo, who campaigned outside parliament
Where does this leave Argentina?
For the bill's advocates, legalising abortion is an urgent public health matter. Tens of thousands of women in Argentina are taken to hospital every year after illegal abortions. In 2016, 43 women died.
Those that can afford it use drugs to terminate their pregnancies while poorer women turn to far cruder methods.
Uruguay and Cuba are the only Latin American nations to have decriminalised abortion. It is largely prohibited across the region except in restricted cases.
El Salvador: Where women may be jailed for miscarrying
The Supreme Court in Latin America's most populous country Brazil has begun hearing from both sides on whether abortion should be legalised up to 12 weeks.
In May, another largely Catholic country, the Republic of Ireland, voted overwhelmingly in a referendum to overturn a ban on abortion.
The global trend has been towards legalisation but the debate continues - in the US, for instance, changes to the Supreme Court has led to speculation abortion could be made illegal in some states.