Golnaz Fakhimi has some advice for Bensalem officials who want their police officers to help federal immigration agents arrest and detain undocumented immigrants:

Be careful — these kinds of partnerships can get unexpectedly pricey.

Fakhimi knows. She's the immigrant-rights lawyer at the Pennsylvania ACLU, which successfully sued Lehigh County and Allentown authorities for keeping a man of Puerto Rican descent in jail — even after he posted bail — so U.S. Immigration and Customs Enforcement could investigate whether he was in the country illegally.

It turned out that Ernesto Galarza was born in New Jersey. His settlement for three days behind bars in 2008 totaled $145,000.

"Whatever the intentions under these partnerships, in practice we've seen there are lots of problems with how they're implemented on the ground," Fakhimi said.

In Bensalem, a Bucks County community of 60,354 that hugs the border of Northeast Philadelphia, township leaders say they're moving toward an agreement to have the police enforce federal immigration laws — confident that it will make people safer. They say officers will be able to identify and arrest dangerous criminals without infringing on individual rights or even bothering law-abiding, undocumented immigrants.

"We will stay within the law," said Mayor Joe DiGirolamo, the son of Italian immigrants. "No profiling, we would never do that. … I'm OK with arresting a criminal, and if they're an illegal immigrant, then certainly you turn them over to ICE."

It's unclear how quickly the township and federal government could reach an accord, formalized through a signed memorandum of agreement. If approved, Bensalem would be the first Pennsylvania police agency to partner with ICE under a program known by its legislative clause — 287(g). And it would bring an often-controversial initiative to a township proud of its diversity.

Bensalem is about 75 percent white, 11 percent Asian, 8 percent Latino, and 7 percent black, Census figures show. One out of every five residents is foreign-born. The township is home to a Buddhist temple and a gambling casino, to the Neshaminy Mall and the Nicholas Biddle estate, Andalusia.

DiGirolamo and township Public Safety Director Fred Harran say officers would not go barging into local businesses or restaurants to check workers' statuses — precisely what ICE agents did last week when they raided almost 100 7-Eleven stores across the country, including four elsewhere in Pennsylvania.

The Bensalem leaders said the ICE partnership would come into play only in situations where an officer would normally make an arrest. For instance, a motorist pulled over for an expired inspection sticker would be ticketed and fined. That's the penalty for everyone. A driver stopped and arrested for drunken driving, if undocumented, would be turned over to ICE.

But advocacy groups, including the Bucks County NAACP and Buxmont Inclusive and Progressive, say the alliance is not only unneeded, but certain to create fear in immigrant communities and hurt relations between police officers and residents.

"The only thing that 287g adds is the ability to do racial profiling," said Adanjesus Marin, state director of Make the Road Pennsylvania, which supports Latino and working-class communities. "They're talking about opening up the township to a big liability."

Many jurisdictions want no part — including the sanctuary city next door. In November, Philadelphia officials won a preliminary court injunction to block the Trump administration's effort to withhold grant money from sanctuary cities.

Police Commissioner Richard Ross testified that Philadelphia officers arrest people who commit crimes — period. At the same time, the department depends on tips and information from law-abiding citizens, he said, and part of that trust is built on the fact that police do not routinely collect and store data on whether people might be in this country illegally.

"There's no way in the world you'd want to come forward as a source of information or criminal activity if you learned you would be deported," Ross testified.

ICE officials say alliances with state and local police strengthen public safety, make immigration enforcement more consistent, and serve as force-multipliers — allowing a given number of personnel to dramatically increase their effectiveness.

Despite its fearsome reputation, ICE has only about 20,000 employees, spread across the United States and 46 foreign countries. In comparison, 51,000 people work for the New York City Police Department.

More local police agencies have signed on during the last year, as what was a dormant 287(g) program has been revived by President Trump, amid his administration's tougher stance toward immigration and immigrants.  ICE now has agreements in 18 states with 60 law-enforcement agencies including sheriffs' offices, corrections departments and detention centers, and has trained and certified more than 1,822 officers.

Too often, however, the partnerships deliver more trouble than benefit, adding expense and paperwork and potentially opening the locality to liability, said Tanya Golash-Boza, a sociologist at the University of California-Merced and the author of Immigration Nation.

In 2014, Salt Lake County, Utah, paid $75,000 to settle a lawsuit brought by a college student who was kept in jail by an ICE detainer for 46 days after he posted bail. An Oregon woman won $30,100 in a similar case in 2015.

Pennsylvania taxpayers footed the bill in 2014 for an incident six years earlier.

On Nov. 20, 2008, court records state, Ernesto Galarza, then 34, was working at an Allentown construction site when the contractor was arrested for allegedly selling cocaine to an undercover police detective. Galarza also was arrested — and later acquitted.

The detective followed what was then Allentown policy, contacting ICE when arrests were made of people suspected of being "aliens subject to deportation," court records show.

That evening Galarza was moved to Lehigh County Prison and his bail set at $15,000, even as he insisted he was a U.S. citizen. ICE filed an immigration detainer that described Galarza as a suspected alien and citizen of the Dominican Republic.

A surety company posted Galarza's bail, but he was not allowed to leave. Three days after his arrest, Galarza was questioned by two ICE officers. The detainer was lifted. He was released that night.

"The policy of 'getting criminals off the street,'" said Fakhimi, the ACLU lawyer, "doesn't hold up."