Sanctuary cities such as Philadelphia are depicted on the right as renegade jurisdictions with little regard for laws and democratic traditions.

But there's a persuasive body of law supporting policies in hundreds of cities and counties that refrain from assisting federal authorities in apprehending undocumented immigrants.

That's why the Philadelphia Bar Association, the city's premier professional group for lawyers, adopted a resolution in October supporting efforts to shield illegal immigrants from the reach of the federal Immigration and Customs Enforcement agency.

But the politics of immigration, along with the moral calculus, are tricky.

In a statement in January, city bar chancellor Deborah R. Gross reaffirmed the Bar Association's support for the city on immigration, saying: "The United States is a country built on dreams, and individuals of diverse backgrounds should be welcomed."

But does that welcome -- from a group whose members are pledged to venerate the law -- apply to people who have skirted rules to get here?

There are about 50,000 undocumented immigrants in Philadelphia, a Pew Research Center report concluded last month. What makes the issue -- and those numbers -- so volatile is that President Trump, elected in part on promises to further curb immigration, has vowed to cut federal funding for cities like Philadelphia, saying sanctuary policies flout the law.

The city's sanctuary policy goes beyond refraining from helping the feds and extends to offering an array of services, including access to schools and medical and mental-health care. It is city policy not to ask for immigration status during intake for these services.

A taxpayer might ask why that same government is helping people who came here illegally.

Yes, the vast majority are decent, hardworking people, and some attempt must be made to let them come out of the shadows, so long as the borders have been secured. Many were induced to cross the border by the quiet acquiescence of congressional leaders, both Democrats and Republicans, who claimed to have fixed the problem in the late 1980s but had not.

The American people never would tolerate the cruelty of mass expulsion.

Yet, laws either mean something or they don't. Should local governments welcome undocumented immigrants absent some action by Congress authorizing them to be here? That is the way the legal system is supposed to work.

On a strictly legal basis, the city is on solid ground in not cooperating with ICE, based on a 2014 opinion by the U.S. Court of Appeals for the Third Circuit in Galarza v. Szalczyk. Allentown police arrested Ernesto Galarza at a construction site where he was working in 2008 and charged him and two others with trafficking in cocaine.

Galarza, a U.S. citizen, was taken to the Lehigh County jail and scheduled for release, but jail authorities continued to hold him after the feds issued a detainer request falsely claiming that Galarza was in the country illegally.

Galarza spent what was surely a horrible weekend in jail and on the following Monday convinced  officials that he was a U.S. citizen.

Galarza sued Lehigh County and Allentown, alleging that his constitutional rights had been violated. The Third Circuit agreed and found that under the Fourth Amendment, which guards against unreasonable searches and seizures, Lehigh County had no right to hold Galarza after he had made bail on the drug charges without a warrant from ICE, which it did not have.

More important for sanctuary cities like Philadelphia, the appeals panel said that under the 10th Amendment's anti-commandeering clause, the feds had no right to enlist the city in its immigration enforcement schemes.

The logic of the 10th amendment is elegant in its simplicity: All powers not specifically delegated to the federal government accrue to the states, and the feds have no authority to order a state to do something it does not want to do. That is why a key feature of the Affordable Care Act -- the expansion of the state and federal health-care program, Medicaid -- was voluntary. To get states to go along, the feds had to pony up billions of dollars as an inducement.

In Philadelphia, the issues play out daily. The city's respected city solicitor, Harvard law grad Sozi Pedro Tulante, an immigrant from what is now called the Democratic Republic of Congo, said that although the city won't cooperate with ICE, it would turn over a suspected undocumented immigrant, already under arrest, if the feds present a warrant. He points out that U.S. immigration laws are part of the civil code and violating them is not a criminal offense.

At the same time, immigration agents are free to roam the streets here in search of undocumented immigrants; authorities will do nothing to stop them, says Miriam Enriquez, director of the city's office of immigrant affairs.

Gross, of the Bar Association, said the group intends to stay out of politics; hence its focus on the constitutional issues. But given the emotionally freighted nature of this subject, that may be impossible.