BOSTON (AP) — The Barnstable County Sheriff's Office in Massachusetts is ending an agreement with U.S. Immigration and Customs Enforcement that gave deputies the authority to enforce federal immigration laws, civil rights attorneys said Wednesday. The Barnstable department was the last sheriff's office in New England with such an agreement, called a 287(g), according to Lawyers for Civil Rights and the American Civil Liberties Union of Massachusetts.

Lawyers for Civil Rights sued the sheriff's office last February in an effort to end the agreement.

According to the complaint, such agreements allow "sheriffs' offices to designate staff members for training and certification in federal immigration enforcement and give them the authority to interrogate any detained person who the officer believes may be an undocumented immigrant, serve and execute warrants for arrest or removal, and transport immigrants to ICE-approved detention facilities."

State law gives sheriffs no such powers, the suit said. Sheriffs oversee the county jails in Massachusetts.

The agreements do nothing but create fear in immigrant communities and drain state resources, it said.

Lawyers for Civil Rights anticipates dropping the lawsuit, attorney Oren Sellstrom said.

New Barnstable Sheriff Donna Buckley, who made a pledge to end the agreement a central part of her campaign, was sworn in Wednesday. She replaced James Cummings, who retired after 24 years on the job.

Barnstable County includes Cape Cod.

"This program has not proven to keep us safer and causes many living on Cape Cod to live in fear. That fear ends today," Buckley, a Democrat, said in a statement.

Bristol and Plymouth counties had similar agreements, but both ended in 2021.

An email seeking comment was left with a spokesperson for ICE's Boston field office. The ACLU, which was not a party to the lawsuit, applauded the sheriff's decision.

"Across the country, 287(g) agreements turn local police and sheriffs into de facto ICE agents," executive director Carol Rose said. "The result is that even the most minor interactions with local law enforcement can lead to detention, deportation, and family separation."