With immigrant rights activists screaming on one side and Donald J. Trump supporters screaming on the other, Santa Ana City Council members decided Tuesday to slowly phase out the city’s controversial agreement with the federal government to jail immigration detainees.

The decision affirms a move council members made in February to “terminate” city jail services altogether. At the time, they were considering expanding the number of ICE detainees in the jail, but, after a backlash from the immigrants’ rights activists, they decided to move in the opposite direction. The council’s decision means they will keep the ICE contract going until it expires in 2020, while slowly reducing jail staff until then.

The 512-bed jail is the latest flashpoint in an ongoing push and pull between the city’s power structure and immigrant rights activists in this 80-percent-Latino city. U.S. Immigration and Customs Enforcement pays the city to jail undocumented immigrants in exchange for a daily fee, and the city uses the revenue to subsidize jail operations. Activists call this arrangement morally unconscionable for a city with so many Latino residents who immigrated without legal status.

Anger over the ICE contract has been steadily rising in recent years and reached a boiling point at Tuesday night’s meeting, which took place a day after activists began a hunger strike aimed at ending the agreement. A group of ICE and Trump supporters in the council chambers added even more tension to the situation.

Hairo Cortes, an advocate with the Orange County Immigrant Youth United, said the council needed to show the courage to stand up for its community.

“The question we’re really dealing with here is political will – political will in an election year,” Cortes said.

Meanwhile, Trump and ICE supporters called on the council to continue the ICE contract and argued that if the detainees hadn’t broken the law, they wouldn’t have found themselves in jail.

“Jail is not intended to be a Marriott Hotel with butler service,” said Agnes Gibboney, who described herself as a legal immigrant and said her son was killed by an illegal immigrant.

“Don’t break the law, and you won’t be in jail.”

While the protests didn’t move city leaders from their policy of phasing out the ICE contract, their rationale for not terminating it immediately has evolved. In recent years, the primary argument from officials for keeping the jail open was the impact on its budget.

Voice of OC published an article Monday showing that in all likelihood, the most financially prudent option would be to shut down the entire jail facility and book city arrestees at the county jail, which already houses them after they’re booked.

City officials say that even if they close most of the jail, they would still keep its holding facility open, so they can continue booking local arrestees.

According to figures provided by the city, the operating cost of the jail this fiscal year will be $19.7 million. Meanwhile, the jail will bring in only $14.9 million in revenue through the ICE contract and another detainee agreement with the U.S. Marshall’s Service.

That’s a shortfall of $4.8 million. Meanwhile, closing the jail completely would mean only paying for the jail’s debt service, which is about $3 million annually. So assuming the gap remains about the same over the next four years, the city could save over $7 million by closing the jail.

But that would require layoffs of dozens of jail employees and would no doubt outrage the city’s police union.

No council member has openly considered shuttering the entire jail — including the holding facility — and Tuesday night was no exception. Councilman Roman Reyna defended the jail’s employees, pointing out that the same protesters who are calling for an immediate end to the ICE contract are some of the same activists who have called for good paying union jobs.

Councilman Sal Tinajero referred to public comments from Rev. Kent Doss, a clergyman with the group Friends of Orange County Detainees who has spent time with inmates at the Santa Ana Jail. Doss called for an end to the ICE contract, but not immediately because inmates would be shipped to jails in other jurisdictions – he referenced Texas – not respectful of LGBT rights and far from the “watchful eye” of caring neighbors.

The city jail has a special unit for transgender detainees, and officials tout it as one of the more humane ICE detention centers in the country. However, many transgender women there have complained of abuse, and a recent Human Rights Report called out the jail for having strip searches of transgender women conducted by male correctional officers.

On Tuesday night, council members also approved entering into a “transgender care and classification committee” program, whereby transgender women would have some say in how they want to be housed.

“You can’t turn off the switch tonight. You just can’t – it’s not responsible,” Tinajero said.

Activists responded that Doss and Tinajero misunderstood their plan. They say the ICE contract cancellation is the first piece in a nationwide fight to pressure ICE into alternative detention programs whereby undocumented immigrants’ cases are processed without jailing them.

Carlos Perea, program director at the youth immigrant coalition RAIZ, said that without the Santa Ana facility, ICE would be in the politically difficult position of having to ship inmates out of state and away from their families. That would give activists the leverage they need to pressure ICE into using alternative detention programs.

“We see this jail as ground zero to be able to fight back nationwide against detentions,” Perea said.

Perea said the activists have discussed this with council members and gave them talking points, only to see council members twist those talking points into justifications for keeping the ICE contract.

Meanwhile, Trump supporters highlighted victims of undocumented immigrants, as part of a “Remembrance Project” initiative.

And the Trump supporters clashed frequently with the immigrants’ rights activists. One woman, a member of We The People Rising named Betty Robinson, appeared to blame undocumented immigrants who are indigenous but not American citizens for fleeing their native lands.

“If indigenous people in this area had stayed on their own land, they would be American citizens today,” Robinson said, prompting expressions of shock from many in the audience.

Tinajero didn’t take kindly to some of the rhetoric, telling the Trump supporters, “you’re in my house now.” He rattled off statistics showing that crimes are committed at a higher rate by residents born in the country than immigrants.

But despite Tinajero’s remarks, Perea said it was frustrating to see council members side with Trump supporters on keeping the ICE contract intact, at least for a while.

In addition to a slow phase-out of the ICE contract, council members asked city staff to study possible alternative detention programs and look at improving conditions at the jail. They also authorized spending $50,000 to hire a consultant to study possible other uses of the jail. The vote was 6-0 for those moves, with Councilwoman Michele Martinez absent.

In a separate vote, council members directed the city manager to offer voluntary retirement incentives to current jail staff as part of the effort to terminate jail services in the long-run. The vote was 5-1, with Mayor Miguel Pulido dissenting. Pulido said he didn’t want to begin de-staffing the jail before officials figured out what they would do next with the facility.

After the council decision to keep the ICE contract until 2020, activists refused to leave the meeting for several minutes, chanting “shut down ICE” and “end trans detention.”

Edgar Vargas — an undocumented immigrant whose beating by Santa Ana police officers drew national attention and a federal grand jury investigation — was arrested last week for allegedly running through homes and being high on drugs.