SAN FRANCISCO — Open-air heroin use. Sidewalks smeared in human feces. Blocklong homeless camps and people with severe mental illnesses wading through traffic in socks and hospital clothes.

You would be forgiven if you thought that those descriptions of California’s urban ills came from the mouth of the state’s biggest detractor, President Trump. After all, as the president jetted off to the Bay Area on Tuesday for a fund-raiser, he took a moment with reporters on Air Force One to fulminate against “people living in our best highways, our best streets, our best entrances to buildings.”

But no, the worst descriptions of homelessness here frequently come from San Francisco’s archliberal politicians, who found themselves this week uncomfortably in agreement with the president they loathe. Mr. Trump’s sudden fixation with California’s homelessness problem is the rarest of cases where the state’s left wing actually recognizes a problem that the president feels strongly about.

Numerous protesters and politicians said they found Mr. Trump’s sudden interest in homelessness to be disingenuous and an example of the administration trying to score political points at the state’s expense instead of actually grappling with a humanitarian crisis that has become the driving political issue in state and local politics. The Department of Housing and Urban Development is, after all, putting into effect new regulations that could turn thousands of legal residents and citizens, including 55,000 children, out of public housing.