Dennis Herrera
San Francisco City Attorney Dennis Herrera announces he has filed a lawsuit against President Donald Trump challenging the executive order threatening to withhold federal funds from sanctuary cities, Jan. 31, 2017. Kate Munsch/Reuters

The city of San Francisco filed the first lawsuit Tuesday against the federal government, calling President Donald Trump’s executive order threatening to withhold federal funds from sanctuary cities unconstitutional.

At a City Hall news conference, San Francisco City Atty. Dennis Herrera described Trump's orders as "un-American" and unconstitutional, citing the 10th Amendment, which limits the federal government from interfering with powers reserved to the states.

“It is necessary to defend the people of this city, this state and this country from the wild overreach of a president whose words and actions have thus far shown little respect for our Constitution or the rule of law,” Herrera said, adding that the federal government cannot force cities to do its bidding.

"That remains true no matter who is in charge of Washington,” he said.

"Obey the rule of law. Abide by the Constitution. You're not [an] emperor who rules by fiat," Herrera advised Trump.

There are more than 400 sanctuary cities and counties around the country, including New York, Chicago and Los Angeles. The cities restrict cooperation with federal immigration officials.

Trump signed an executive order last week threatening to deny federal funds to any city that does not grant requests to hold undocumented inmates indefinitely for immigration officials. It blocks federal grants and revives the Secure Communities program that was ended by the Obama administration.

So far, only Miami has agreed publicly to follow the order.

San Francisco, which has an estimated 30,000 undocumented immigrants, receives more than $1 billion from the federal government annually, about 10 percent of its budget.

In addition to Trump, the suit names Homeland Security Secretary John Kelly and Acting Attorney General Dana Boente, who was appointed Monday night after former Acting Attorney General Sally Yates refused to enforce Trump’s executive order on immigrants from seven countries.

During the campaign, Trump singled out San Francisco for the fatal shooting of a woman at a popular tourist spot as evidence something needs to be done about the U.S. border with Mexico and the estimated 11 million undocumented immigrants living in the U.S.

San Francisco Mayor Ed Lee, as well as his counterparts in other cities, has argued sanctuary cities are safer because undocumented residents feel free to interact with police and seek medical care.