SAN FRANCISCO (KTVU & BCN) -- City officials on Tuesday announced that San Francisco will file a lawsuit against the Trump Administration over the president's executive order that strips federal funding from municipalities that have adopted sanctuary city status.

Mayor Ed Lee and City Attorney Dennis Herrera announced the filing during a news conference. The lawsuit represents the first court challenge filed by a city over the Trump plan to withhold federal funding from cities that have adopted sanctuary city status.

"In blatant disregard of the law, President of the United States seeks to coerce local authorities into abandoning what are known as ‘Sanctuary City’ laws and policies," said the lawsuit, which was filed in San Francisco federal court.

The term "sanctuary city" is used to specify jurisdictions that limit or restrict their cooperation with federal immigration enforcement agents who seek to deport residents who have illegally immigrated to the U.S.

Other so-called sanctuary cities in the Bay Area include Oakland, Berkeley and San Jose.

Mayor Lee said the city's reputation for helping the disadvantaged puts it at odd with the Trump White House.

"It's no surprise this president could target us," Mayor Lee said during the press conference. "This is why we have to be prepared."

City Attorney Herrera said cities are being forced to comply with mandates from the Trump White House.

"The threat of cutting off federal grants to coerce cities like San Francisco won’t hold up in court," Herrera said. "It violates the law, and it will be challenged."

The executive order, signed last Wednesday, directs federal agencies to cut off federal grant funds to cities such as San Francisco with sanctuary city policies that limit the cooperation of local law enforcement and government agencies with federal immigration authorities.

San Francisco receives around $1.2 billion in federal funds, about half of which is dispersed through the state and half directly from federal agencies. City officials say it remains unclear exactly what funds would be affected by the executive order, but the bulk of those funds go for programs such as health care, nutrition and housing.

Lee said today that San Francisco has been working to prepare for its legal defense ever since Trump's election in November. The mayor has vowed to maintain the city's sanctuary city policies, which are intended to increase public safety by encouraging immigrant communities to cooperate with law enforcement, seek health care and enroll their children in schools.

"We are ready to fight, to keep our city safe," Lee said. "The president's misguided executive order makes our residents less safe and as a city we will fight back."

The city's lawsuit asserts that the city is in compliance with federal laws regarding the sharing of information on immigration status, but also challenges the constitutionality of those laws, which underlie the executive order, Herrera said.

The order also directly violates constitutional protections on San Francisco's autonomy and sovereign powers as a local government, according to the lawsuit.

Herrera said courts have repeatedly upheld the finding that the federal government cannot force local governments to act as agents of federal policy, most recently in a 2012 U.S. Supreme Court ruling that found states could not be forced to comply with elements of the Affordable Care Act.

"The federal government can't hold a gun to the head of state and local governments," Herrera said. "That remains true no matter who is making the order."

San Francisco adopted a sanctuary city policy 28 years ago after local officials recognized that domestic violence victims were unwilling to report their attackers to police because they feared deportation. More than 400 cities and counties across the country have similar policies on the books, including New York and Los Angeles.

While opponents of sanctuary city policies have argued the policies threaten public safety, Herrera cited a University of San Diego study that found sanctuary jurisdictions tend to have, on average, 35.5 fewer crimes committed per 10,000 people compared to non-sanctuary jurisdictions.

San Francisco, the policy drew national notoriety after the July 1, 2015, fatal shooting of Kate Steinle, a 32-year-old Pleasanton native, by Juan Francisco Lopez-Sanchez, a Mexican citizen with a history of drug convictions and deportations.

Lopez-Sanchez had been released from San Francisco's jails a few days before the shooting.

Steinle's family sued the city because the sheriff's department had released Lopez-Sanchez without notifying immigration authorities.

However, a federal judge threw out the family's case against the city earlier this month, saying there was no law requiring the city to disclose his release date.

The Board of Supervisors voted in May to uphold and revise the city's policies to clarify that law enforcement would only notify immigration authorities of an inmate's release in limited circumstances involving serious felonies.