Women take part in a protest June 22 demanding the legalization of abortion in Rio de Janeiro. (Silvia Izquierdo/AP)

SAO PAULO — Brazil’s supreme court is considering decriminalizing abortion through the 12th week of pregnancy, stoking activists' hopes that the country could follow other Latin American nations in loosening abortion restrictions.

Hearings on the issue, which began Friday and continued on Monday, included testimony from dozens of doctors, specialists and religious leaders. Tensions flared in the days leading up to the hearings, with activists on both sides speaking out. Outside the supreme court on Friday, women donned red robes resembling those worn on the hit TV show, “The Handmaid’s Tale,” in favor of decriminalization. Meanwhile, #AbortionisaCrime trended on Twitter, and churches sounded their bells in protest.

Debora Diniz, an anthropology professor and activist who spoke at the hearing, received death threats in the days before her testimony and was placed in a witness-protection program. “This topic needs to be addressed and confronted. It won’t be silenced with hate or threats,” she said in an interview with The Washington Post.

Abortion is banned in almost all cases in Brazil and is punishable by up to three years in prison. Still, 1 in 5 Brazilian women younger than 40 has undergone an abortion, according to a 2016 poll.

Illegal abortions are often dangerous — botched attempts claim about 200 lives per year in Brazil, and most of the victims are young, black and single. Hundreds of thousands of women have ended up in the hospital with complications from illegal abortions, according to Brazil’s Ministry of Health. The medical complications have cost the cash-strapped public health system $130 million over the past 10 years.

A majority of Brazilians remains staunchly against the legalization of abortion, but polls show a growing number believe that women who have abortions should not go to jail. The number of Brazilians who support decriminalization grew from 23 percent in 2016 to 36 percent in 2017.

Shifting attitudes across conservative Latin America have given many activists hope that Brazil could loosen restrictions. In 2006, Colombia lifted a blanket ban on abortion. Chile followed suit last year, and Argentina’s Senate is voting this week on a bill that would legalize the procedure through the 14th week of pregnancy.

But the opposition to decriminalizing abortion remains stark. Professor Hermes Rodrigues Nery, the president of the National Pro-Life and Pro-Family Association, testified on Friday that rather than loosening abortion restrictions, Brazil needs to deal with the root causes of the poverty that, he said, prompt poor women to seek abortions.

“It is a false solution; for where we should be fighting the causes of poverty, we chose to fight the poor," he said. "It is a battle between those with power and those without, who need support.”

And even as the supreme court considers the issue, evangelical Christian members of Brazil’s Congress have been pushing a bill that would make abortions illegal in all circumstances. The bill was approved by a congressional committee last November but has yet to be passed by both houses.

Jair Bolsonaro, the leading conservative presidential candidate in Brazil’s upcoming elections, opposes abortion rights and has pledged to veto any attempts by Congress to decriminalize the procedure.

Brazil’s Ministry of Health declined to take a position but said in a statement that “the illegality [of abortion] does not prevent it from occurring, however it drastically affects access to a secure procedure, increasing the risk of complications and avoidable maternal death.”

Read more:

How the prosperity gospel is sparking a major change in predominantly Catholic Brazil

A Trump-like politician in Brazil could snag the support of a powerful religious group: evangelicals

Less skin, more God and no racism: How Brazil’s left and right want to change Carnaval