Trump's primary mission during his two-day visit to the state was to raise millions from wealthy Republicans. But he also made a point of deriding the state's handling of its homeless crisis, and on Wednesday, he issued a long-expected challenge to California's authority to reduce car emissions.
Later, he threatened to sic the Environmental Protection Agency on San Francisco over its homeless population, accusing the city of allowing a tremendous amount of waste, including needles, to go through storm drains into the ocean.
"It's a terrible situation that's in Los Angeles and in San Francisco," Trump told reporters on Air Force One as he returned to Washington. "And we're going to be giving San Francisco - they're in total violation - we're going to be giving them a notice very soon."
Gov. Gavin Newsom, a Democrat, publicly called out the Trump White House for a lack of "moral authority" and lamented the state's "unfortunate relationship" with the president.
The president and many Republicans see little downside to him making the nation's most populous state a ready villain.
"The voters that he's targeting in rural America look at California as an out-of-touch liberal state," said Republican consultant Alex Conant. "There's no political cost to him bashing California."
Trump and the Democratic-led state have battled throughout his 2½ years in office, with state Attorney General Xavier Becerra filing more than 50 lawsuits against the Trump administration. They cover the president's initiatives on immigration, health care and the environment, and have slowed and occasionally stopped the administration altogether.
And it's not just the president's agenda that California has gone after; the sparring has gotten personal, too. The state passed a law that requires candidates for president and governor to release five years' worth of tax returns to appear on the state's primary ballot, a pointed slap at Trump, who veered from historical precedent by declining to release his tax returns.
Trump began his latest criticisms of the state before he had even landed on Tuesday, faulting the cities of Los Angeles and San Francisco for not doing enough on homelessness. On Wednesday, he jumped ahead of his EPA to announce via tweet that his administration was revoking California's authority to set auto mileage standards, insisting the action will result in safe, less expensive cars and more jobs for Americans.
With all sides acknowledging the state's serious problems with homelessness, the issue stands as a vulnerability for Democratic leaders, and one that Trump can use as part of his broader effort to paint Democrats as out of touch and extreme. The president has yet to provide any specifics on how to deal with the complex homelessness problem, though.
Sen. Dianne Feinstein, D-Calif., allowed that Trump was "right that homelessness is a big problem in California. But how he explains the situation is wrong and raises significant concerns that his so-called solutions will only make matters worse."
GOP Rep. Kevin McCarthy, the House minority leader and an early ally of the president, said Trump wasn't bashing his home state but pointing out the shortcomings of Democratic leadership that has dominated California politics for years, especially as the Golden State has become the forefront of the Trump resistance.
"When he's talking about homelessness and solving that problem, and affordability, that goes across party lines," McCarthy told The Associated Press.
"Drive around - every community, even in Bakersfield - homelessness is the No. 1 issue," he said, referring to his own district in the rural Central Valley, just outside Los Angeles.
"They want to try to attack him, but you see how much support he has out there?" he said. "I think Californians are getting tired of the governor just fighting this president instead of trying to work with him. You don't have to agree with him all the time, but you can find common ground."
Newsom, in return, said he wants to work with Trump but is determined to "push back when he tries to go after our dreams" on diversity, reproductive rights and more.
"I don't think the attorney general wakes up looking for a lawsuit," but most of the cases involved are an attack on the state, he said. "And so it's an unfortunate relationship."
That may not be unfortunate for Trump politically, though.
Tim Miller, a former spokesman for Jeb Bush and a longtime Trump critic, said that when Trump talks about the homeless problem in California and criticizes its political leaders, "he's not speaking to California Republicans. He's speaking to Republicans and independents nationally. I anticipate he'll continue that through 2020."
Trump's presence in California and his attacks on its policies and politics were a welcome boost for the state's Republicans.
"My Republican friends in California keep their heads down and think the place has lost its mind," Conant said. "It's not as if he's going into South Dakota and attacking the state's politics."
But while Trump's swipes at the state's Democratic leadership were cheered by the GOP faithful, the political dynamics will be more complicated in closely divided congressional districts the party hopes to retake in 2020. Democrats picked up a string of Republican House seats in 2018, including in the onetime GOP stronghold of Orange County. In those contests, Democrats frequently sought to link GOP candidates to Trump, who is widely unpopular in California outside his Republican base.
Trump used his last stop in the state Wednesday to take a tour of border wall going up near San Diego. He visited two of the earlier wall projects funded on his watch. Last month, the administration completed 14 miles (23 kilometers) of steel bollards up to 30 feet (9 meters) high, except for a small stretch where homes in Tijuana, Mexico, blocked the construction path, triggering bilateral talks about whether to knock them down. The $147 million project replaced a much shorter fence made of surplus airstrip landing mats from the Vietnam War.
For Trump, building the wall is one of the biggest priorities of his presidency. "Build that wall" is a chant heard still at his campaign rallies.
Associated Press writers Lisa Mascaro and Hannah Fingerhut in Washington and Adam Beam in Sacramento contributed to this report.
Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.