After touring prototypes for his planned border wall in San Diego Tuesday, President Donald Trump railed against cities in California and elsewhere that refuse to work with federal immigration agents to detain undocumented immigrants.

“California sanctuary policies put the entire nation at risk,” Trump said. “They’re the best friend of the criminal. That’s what exactly is happening. The criminals take refuge in these sanctuary cities, and it’s very dangerous for our police and enforcement folks.”

President Trump and Attorney General Jeff Sessions have long called for federal grant money to be withheld from sanctuary cities, and Trump said Tuesday that now is the time for Congress to act.

“In the upcoming omnibus budget bill, Congress must fund the border wall and prohibit grants to sanctuary jurisdictions that threaten the security of our country and the people of our country,” Trump said. “We must enforce our laws and protect our people.”

Current government funding expires March 23, and the slim Republican majority in the Senate means any agreement to keep the government open will need to be at least somewhat bipartisan. Despite firm Democratic opposition to both building a border wall and punishing sanctuary cities, some Republicans in Congress agree with his stance that they should be included in the legislation.

Rep. Matt Gaetz, R-Fla., argued Wednesday that the danger created by sanctuary jurisdictions justifies putting penalties for them in a must-pass spending bill.

“Sanctuary cities pose a threat to our country and we cannot live in circumstances where individual jurisdictions can choose which federal laws they want to enforce and which ones they want to ignore,” he said.

“The president believes there should be consequence for localities that choose to give sanctuary to people who might do Americans harm and who have broken the law,” Gaetz said, “and I think those consequences would be appropriate to include in our omnibus spending bill.”

Trump’s comments in San Diego Tuesday came less than a week after his administration took its most aggressive step yet against sanctuary jurisdictions by suing the state of California over laws that limit the ability of local law enforcement to work with immigration officials.

"Federal law determines immigration policy," Sessions said in a Fox News interview last week. "The state of California is not entitled to block that activity. Somebody needs to stand up and say, 'No, you've gone too far. You cannot do this.'"

Allies of the president say such an attitude undermines the rule of law. Rep. Mark Meadows, R-N.C., chair of the House Freedom Caucus, has endorsed attaching the defunding of sanctuary cities to the spending bill.

“Why should Congress continue pouring taxpayer dollars into cities that defy federal immigration law? That shouldn't happen in America--a nation of law and order,” he tweeted Sunday.

While some House Republicans have backed Trump’s request, even senators who agree with the president on immigration policy say including those provisions in the omnibus bill could prevent them from getting the nine Democratic votes they need to pass the bill in their chamber.

“I mean, Congressman Meadows may feel like that is a good idea but practically speaking that will be really difficult to get done,” Boozman said.

Sen. Thom Tillis, R-N.C., raised similar concerns about the feasibility of attaining bipartisan support for immigration demands that have proven highly controversial in the past.

“I think those provisions in the omnibus bill could be a problem just to get Democrat support for the funding of the bill,” he said.

Legislatively, Tillis also sees resolving the status of young immigrants who were protected by the Deferred Action for Childhood Arrivals program as a higher immigration policy priority. He believes a permanent solution to that problem could also include border security funding and reforms to legal immigration.

“Let’s not punt on something we were so close to solving,” he said.

Sen. David Perdue, R-Ga., observed that legal questions surrounding sanctuary cities are in the process of being resolved in the court system, but he has no doubt the president is within his rights to cut off their federal funding.

“That’s outrageous that a local community will decide to disobey federal law,” he said. “I just don’t understand that.”

Perdue did not directly address whether that issue or wall funding should be tied to the omnibus bill, but he said building the border wall is a national security imperative that “needs to be done yesterday.”

“This is something we need to be talking about every day up here until we get that funding done,” he said.