President Trump and a California mayor traded barbs over Twitter on Saturday, prompted by the president's repeated threats to release detained immigrants into “sanctuary cities.”

The exchange between Trump and Oakland Mayor Libby Schaaf also appeared to be triggered, at least in part, by recent New York Times articles about the president's immigration policies.

"So interesting to see the Mayor of Oakland and other Sanctuary Cities NOT WANT our currently 'detained immigrants' after release due to the ridiculous court ordered 20 day rule," Trump tweeted.

ANTI-TRUMP OAKLAND MAYOR INSISTS SHE 'DID THE RIGHT THING' IN TIPPING OFF ILLEGAL IMMIGRANTS ABOUT ICE RAID

Schaaf fired back, saying: “It’s time to stop fanning hate and division @realDonaldTrump - I’ve been consistent and clear: #Oakland welcomes all, no matter where you came from or how you got here.”

Trump fired off another tweet soon after: "Just out: The USA has the absolute legal right to have apprehended illegal immigrants transferred to Sanctuary Cities. We hereby demand that they be taken care of at the highest level, especially by the State of California, which is well known or [sic] its poor management & high taxes!"

In 2017, California passed a “sanctuary state” law limiting cooperation between local authorities and federal immigration officials. Administration officials said Trump's proposal to dump undocumented immigrants in "sanctuary cities" was floated and rejected. Trump insists he is still giving the idea strong consideration, according to the Los Angeles Times.

White House deputy press secretary Hogan Gidley said the administration was working with Department of Homeland Security (DHS) and Immigration and Customs Enforcement (ICE) to advance the plan.

"They have said they wanted all of these illegal aliens into their communities," Gidley said on Fox News' "Justice with Judge Jeanine." "We're working with DHS, we're working with ICE, to try and make sure that happens because after all, it's what they want. They should not say 'This is retribution politically,' they should say, 'This is an olive branch."

Schaaf told NPR on Saturday that her city would accept a busload of 5,000 migrants if it had to.

"My job as a mayor is to welcome people," she said. "I don't build walls. It's our job to welcome everyone into our city, ensure their safety, ensure that their families can thrive. And that is my job no matter where those people came from or how they got there."

CLICK HERE TO GET THE FOX NEWS APP

"This is about an outrageous abuse of power," she continued. "The idea that you could use human beings, families as instruments of political payback to use public resources to exact retribution on your political enemies."

Mayors in other cities have also said they are willing to take in migrants.

“We have people who are routinely coming to this city. We have a whole infrastructure that’s built up to make sure that their rights are protected while the city of Chicago has, under the current administration, provided funding for various groups to help support asylum seekers and other people that are going through the immigration court system. I expect it will continue, if not expand upon, those kinds of resources,” said Chicago Mayor-elect Lori Lightfoot.