(CNN) The Trump administration's ongoing feud with sanctuary cities reached a fever pitch this month as the Department of Homeland Security sparred with New York, historically one of the department's strongest partners -- resulting in a week of hostile exchanges between the President and New York governor that ended in a White House showdown.

The clash, triggered by a state law that bars DHS from obtaining information from DMV databases, underscored the increasingly tense relationship between the administration and so-called sanctuary cities, which limit cooperation between local law enforcement and federal immigration authorities.

President Donald Trump has repeatedly railed against those jurisdictions, arguing that they put public safety at risk by restricting access to federal immigration authorities. And while sanctuary policies are not new, they've been pushed to the forefront over the course of Trump's presidency as the administration doubles down on its campaign to end illegal immigration.

"I think we have entered into a place where the debate about immigration policy in this country is an all or nothing all-out battle between the government and advocates -- and the states are in the middle," said Theresa Cardinal Brown, director of immigration and cross-border policy at the Bipartisan Policy Center.

The fight between New York and the Department of Homeland Security that is expected to impact thousands of people is an example of just how politicized the issue has become. The so-called Green Light Law at the center of the fight not only allowed undocumented immigrants to obtain a driver's license, but also barred federal immigration agencies from using the state's DMV database over fear information would be used for immigration enforcement purposes.

In doing so, the law sent a message about supporting undocumented immigrants and issued a strong rebuke against immigration enforcement, setting off a sequence of events that led to New York Gov. Andrew Cuomo's meeting with Trump on Thursday.

"It started with just licenses then it became about protecting immigrants from enforcement and so you merge these two issues that weren't the same issue two years ago," Brown said.

What happened in New York

In December, New York's Department of Motor Vehicles cut US Customs and Border Protection and Immigration and Customs Enforcement -- two immigration agencies within the Department of Homeland Security -- from its databases following the passage of its "Green Light Law," according to a DHS official.

One day, CBP tried to access the DMV records and the agency was just shut out, said a law enforcement official, who added that the records also help the agency prevent high-end stolen cars from being shipped overseas.

Acting Customs and Border Protection Commissioner Mark Morgan recently told reporters that "no one" from New York got in touch with him before the law was passed to discuss the legislation's impact on the agency's operation. "They passed a law and held a press conference," he said.

After the law took effect, acting Homeland Security Secretary Chad Wolf directed agency heads to assess how these laws, like the one in New York, would impact their operations, according to a December 30 memo obtained by CNN.

An internal DHS memo, circulated among senior leadership, evaluated options to mitigate the security risk incurred by New York's decision and persuade a return to prior arrangements, including an option to try to obtain information through states that cooperate with the department, according to a source familiar with the memo, which was first reported by BuzzFeed News

Acting Homeland Security Deputy Secretary Ken Cuccinelli, known for his hardline immigration views, had a major role in this effort, holding meetings and discussions with various parties at the department before the memo was drafted, the source said.

DHS did not directly respond for comment about the policy memo recommendations.

A DHS official told CNN that the department eventually decided that the most pressing issue was CBP's Trusted Travel Programs, which uses DMV databases, among others, to assess applicants. "We needed to act on this now to make sure that we didn't work letting applications get through without the proper vetting," the official said.

The department might be "cutting off their nose to spite their face" in this instance, said Seth Stodder, an attorney and a former Homeland Security official in the Obama administration, who also worked at CBP during the Bush administration.

"The border agencies always have to walk and chew gum at the same time. They have to facilitate lawful commerce and travel and they also have to do security," he added.

After 9/11, these programs were designed to try to allow CBP to collect information on people, so they could move low-risk travelers through faster.

"It's good to have this additional information from the DMV records, but it may be undermining the security of the country," he added, saying CBP needs to justify why the DMV records outweigh the benefit of the programs.

The feud shows no signs of abating. New York Governor Cuomo has accused the department of playing politics. Wolf has pushed back, saying it's about security, not politics.

Before meeting Cuomo on Thursday, Trump tweeted that "New York must stop all of its unnecessary lawsuits & harassment, start cleaning itself up, and lowering taxes."

In a statement Thursday, Wolf said discussions were still ongoing to find a solution.

Administration's continued pressure on sanctuary cities

In the ramp up to the 2020 presidential election, the administration is leaning into the issue of sanctuary policies yet again.

At the start of his presidency, Trump threatened to take federal funds from sanctuary jurisdictions in an executive order. He also floated the possibility of releasing immigrants into sanctuary cities in part to retaliate against Democrats.

Within the last few weeks, DHS barred New York residents from enrolling in certain Trusted Traveler Programs in response to the state's sanctuary law; Trump criticized the policies in his State of the Union address; and Attorney General William Barr announced a round of lawsuits against jurisdictions that limit cooperation with immigration authorities.

Speaking at an annual gathering of sheriffs in Washington, DC, Barr called the lawsuits a "significant escalation in the federal government's efforts to confront the resistance of 'sanctuary cities.' "

US Customs and Border Protection is also deploying 100 agents and officers to support interior immigration enforcement in cities across the country.

In a statement to CNN, acting Immigration and Customs Enforcement Director Matthew Albence said, "ICE is utilizing CBP to supplement enforcement activity in response to the resource challenges stemming from sanctuary city policies." The move, first reported by The New York Times , underscores the fight underway between the administration and these cities.

Many of the largest cities in the country have sanctuary policies in place. The leaders behind them argue that such policies make communities safer because undocumented immigrants are more likely to report crimes if they don't fear deportation.

More than 30 bills related to sanctuary policies -- both for and against them -- are pending across the country, according to the National Conference of State Legislatures

Sanctuary cities are not unique to the Trump administration. The Obama administration also had to navigate pushback from states and advocates, dating back to the expansion of information sharing between states and the Department of Homeland Security.

The Obama administration expanded the Secure Communities Program that began under former President George W. Bush through information-sharing agreements with states and DHS for purposes of immigration enforcement. As deportations ramped up, advocates began urging states to rescind their agreements, recalled former acting Immigration and Customs Enforcement Director John Sandweg.

The success that advocates had on the ground in getting governors to pull their agreements culminated into the modern sanctuary movement, Sandweg said. The Trump administration's controversial immigration policies and heightened rhetoric on the issue has exacerbated the problem.

"This has really, politically, put them under tremendous pressure from advocates to take more actions that frustrate ICE," Sandweg said, referring to states.

Albence has also acknowledged the political nature of the issue: "This is a problem in which politics -- and people are using politics and putting it ahead of public safety," he told reporters late last year. Some law enforcement entities came to the defense of the Department of Homeland Security this week, reiterating the importance of information sharing.

Some argue the heightened immigrant advocacy movement is in response to the administration's enforcement push, escalating the issue and creating an impasse between the administration and states.

"We had these problems under Obama and Bush," Stodder said, "but definitely not compared to the war going on today."