About 18 months after the Trump administration threatened to withhold law enforcement grants from nearly 30 places around the country it felt weren't doing enough to work with federal immigration agents, all but one have received or been cleared to get the money, the Justice Department said.

In most cases, courts chipped away at the crackdown that escalated in November 2017 with letters from former Attorney General Jeff Sessions to 29 cities, metro areas, counties or states it considered as having adopted "sanctuary policies" saying those policies may violate federal law.

Of those 29 jurisdictions — which include cities as large as Los Angeles and as small as Burlington, Vermont — only Oregon has yet to be cleared to receive the grants from 2017, a Justice Department spokesman told The Associated Press this week.

Vermont officials announced Monday that they had been told the state Department of Public Safety would be getting $2.3 million in law enforcement grants that had been blocked. Vermont had not joined any of the legal cases, instead corresponding directly with the Justice Department.

U.S. Sen. Patrick Leahy, a Vermont Democrat, declared victory, saying the money would be used primarily on anti-drug efforts.

"State and local law enforcement agencies already are stretched thin, and withholding these federal grants only makes their work more difficult," Leahy said in an email to the AP. "It's unthinkable that the Trump Justice Department would hold these funds hostage over an unrelated dispute on immigration policy."

Last summer, the U.S. Conference of Mayors sued in Illinois on behalf of its member cities focusing on the issue. In September, a federal court temporarily blocked the Justice Department from withholding the funds for the jurisdictions represented by the conference.

The conference's litigation is now focused on making the order affecting the 2017 grants permanent and apply to 2018 grants, as well, said Kate O'Brien, a Chicago attorney who represented the mayors.

Other federal courts have ruled against the Justice Department. Similar cases are being litigated across the country, and the Justice Department is considering appealing some unfavorable rulings.

The Trump administration has long argued that places that don't cooperate with federal immigration authorities, often called "sanctuary cities," pose a threat to public safety.

"I continue to urge all jurisdictions under review to reconsider policies that place the safety of their communities and their residents at risk," Sessions said in a statement in January 2018. "Protecting criminal aliens from federal immigration authorities defies common sense and undermines the rule of law."

The details differ by jurisdiction, but the Justice Department felt law enforcement agencies in those communities weren't sufficiently committing themselves to cooperating with federal immigration agents when officers came in contact with people who might not be in the country legally.

Aside from confirming the clearance of grants to the 28 jurisdictions , Justice Department spokesman Steven Stafford declined to comment.

Some, but not all, of the 28 jurisdictions were cleared for the grants without changing the policies that triggered the original concern from the Justice Department, now led by Attorney General William Barr. And not all of the places actually have the money in hand yet, or have been told they've been cleared to get it.

Ken Martinez, the county attorney for Bernalillo County, New Mexico, said officials there had yet to hear about 2017 grant funding and are eager to get it.

"It will be incredibly helpful," Martinez said. "I can tell you there's been a high level of frustration from people on both sides of the issue."

In West Palm Beach, Florida, the Justice Department was concerned about the wording of a city resolution dealing with police investigations involving citizenship or immigration status. A year ago, a memo was sent to city employees saying they "may" share information with federal authorities.

"So no funds (were) lost on our end," said police Sgt. David Lefont, noting the total was less than $100,000.

That some of the threatened cities ended up changing their policies amounts to at least a partial victory for the Trump administration, said Jessica Vaughan, the director of policy studies for the Center For Immigration Studies, which advocates for tight restrictions on immigration.

"What it looks like to me, the Trump Administration is not able to fully enforce cooperation with ICE (Immigration and Customs Enforcement) to the extent they would like to, but it is able to fully enforce compliance with existing federal law that some sanctuary jurisdictions have had to change their policies in order to get their money," Vaughan said.

But other jurisdictions were cleared to get the money without having to change anything.

"The court in our cases, and in similar cases throughout the country, has found the attorney general is not authorized to impose these conditions," said O'Brien, the attorney for the mayors' group.

The Vermont settlement of the 2017 grants is among the last.

Even before the 2017 letters were sent, federal courts across the country had begun to rule against the Trump administration's efforts. And they continue.

A federal judge in Los Angeles ruled Feb. 15 that the Justice Department exceeded its authority and ordered a permanent, nationwide injunction against requiring police departments to cooperate with immigration authorities in order to receive the grants.

Oregon, the only one of the 29 jurisdictions not yet cleared for the 2017 grants, last fall filed its own lawsuit against the Justice Department. The lawsuit, which also covers grants for 2018, accused Trump and Matthew Whitaker, acting attorney general at the time, of trying to "impermissibly commandeer the resources" of Oregon and its largest city, Portland.

"For years, these grants have provided millions of dollars to law enforcement in Oregon," Rosenblum said in November. "But, suddenly these public safety funds have been withdrawn because Oregon will not submit to U.S. DOJ's demand that Oregon participate in its immigration enforcement efforts."

Contributing to this report were Associated Press writers Eliot Spagat, Paul Elias, Susan Montoya Bryan, Andrew Selsky and AP News Researcher Jennifer Farrar.