SAN FRANCISCO — A top federal official likened Mayor Libby Schaaf of Oakland to a “gang lookout” on Wednesday, saying her warning of an impending, large-scale arrest operation had given immigrants in the United States illegally the opportunity to flee.

Ms. Schaaf had announced on Saturday that she had learned through “unofficial channels” that the federal Immigrations and Customs Enforcement agency, or ICE, was planning arrests in the area.

“I know that Oakland is a city of law-abiding immigrants and families who deserve to live free from the constant threat of arrest and deportation,” she said in a statement that circulated widely on social media over the weekend. “I believe it is my duty and moral obligation as mayor to give those families fair warning when that threat appears imminent.”

The mayor’s warnings proved correct. Since Sunday night, ICE officers have arrested more than 150 people in Northern California in an operation ICE said was targeting “public safety threats.”

But ICE officials said the mayor’s warning jeopardized officers’ safety, and said that hundreds more undocumented immigrants they had planned to arrest may have eluded the agents after the tip-off.

In a statement, the agency’s acting director, Thomas D. Homan, called Ms. Schaaf’s announcement a “reckless decision” made for political purposes.

Speaking on Wednesday morning on Fox News, Mr. Homan said Ms. Schaaf’s warning was “no better than a gang lookout yelling ‘Police!’ when a police cruiser comes in the neighborhood, except she did it to an entire community.”

The fight between ICE officials and Ms. Schaaf added a fresh layer of acrimony to a battle between the Trump administration, which has stepped up efforts to detain and deport unauthorized immigrants, and California officials determined to resist the president’s agenda.

Image

Mayor Libby Schaaf of Oakland held a news conference on Sunday warning about coming ICE raids in the San Francisco Bay Area.CreditRandy Vazquez/Bay Area News Group, via Associated Press

State laws passed in the last year limit the ability of local police to cooperate with federal immigration officials, and require employers to warn their workers whenever ICE makes a request for employee paperwork, which could give any undocumented employee the chance to leave before federal agents detect their presence.

President Trump, meanwhile, has singled out California for attacks and derision, saying its policies were letting dangerous immigrants live freely in the United States. Mr. Homan, the ICE chief, had promised to increase enforcement in California, saying in January that the state had “better hold on tight.”

James Schwab, a spokesman for ICE in San Francisco, said agents were targeting around 1,000 people in the area, which appeared to be one of the largest operations since Mr. Trump took office. Mr. Homan blamed the mayor’s warning for agents not being able to detain 800 people they had targeted in recent days.

One official briefed on the plans for the operation at the Department of Homeland Security, which includes ICE, said that ICE agents typically find only about 30 percent of their targets during any large sweep. The official, who was not authorized to discuss the operation, declined to be identified.

The 30 percent rate would suggest that while some immigrants may have benefited from the tip-off, it is unlikely that 800 of them did, as Mr. Homan suggested.

Immigration advocates have occasionally sought to warn of rumors of impending ICE arrests, but Ms. Schaaf’s decision was striking because it came from the mayor of one of California’s largest cities.

Ms. Schaaf, the mayor since January 2015, has been a strong promoter of Oakland’s diversity, including its large population of immigrants, who make up around a third of the city’s 420,000 residents.

In an interview on Wednesday, the mayor said she did not regret her decision to issue advance warning.

“I still contend that what I did was both legal and moral,” she said, batting away a suggestion made during Mr. Homan’s appearance on Fox News that she could have obstructed justice. “I did not provide any specific detail that could have endangered law enforcement.”

A Bay Area liberal standard-bearer in a decidedly liberal city, Ms. Schaaf has been an unshrinking critic of Mr. Trump, whom she has called the “bully in chief.”

She said she interpreted the raids as both racist and politically motivated, targeting liberal California.

“The Trump administration and ICE officials have been very transparent that they are retaliating against California for its political position,” she said.

The president, she said, “is trying to equate immigrants with dangerous criminals.”

Although Ms. Schaaf said she had information that ICE had been targeting people in Oakland, she had not heard of any arrests taking place in the city.

Immigrant advocates reported arrests by ICE in Merced, Contra Costa, Sacramento, Monterey and Napa Counties — an area much broader than just the San Francisco Bay Area. On Wednesday, several dozen protesters gathered outside the ICE office in San Francisco, chanting support for undocumented immigrants and writing “KEEP FAMILIES TOGETHER” across an intersection.

While the Obama administration focused arrest efforts on undocumented immigrants who had committed crimes in the United States, Mr. Trump has made clear that anyone in the country without permission can be arrested. Last year, immigration arrests nationwide rose by more than a third from the previous year, in large part because officers have more freedom to detain unauthorized immigrants with no criminal record.

Still, the administration has made a point of highlighting the criminal pasts of undocumented immigrants. Around half of those arrested in Northern California in recent days had previous criminal convictions in addition to immigration violations, said Mr. Schwab, the ICE spokesman.

An ICE statement said some had lengthy criminal records, including one, Armando Nuñez-Salgado, whom the agency called a “documented Sureño gang member” who had been deported four times and who over the past 18 years had accumulated convictions — it listed burglary and hit-and-run causing injury — resulting in more than 15 years in prison.

Mr. Schwab would not say on Wednesday whether the arrest operation was continuing, but he said the agency would issue a statement once it was completed.

Caitlin Dickerson contributed reporting from New York.

A version of this article appears in print on , on Page A14 of the New York edition with the headline: Chief of Immigration Agency Compares Oakland’s Mayor to a ‘Gang Lookout’. Order Reprints | Today’s Paper | Subscribe