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.”