California Gov. Jerry Brown (D) speaks during an event at the National Press Club in Washington on April 17. (Alex Wong/Getty Images)

When President Trump last month made his first trip to California since taking office, he bashed Gov. Jerry Brown for doing “a terrible job” and groused about the state’s high taxes and immigration policies.

Brown, a Democrat who presides over the nation’s most populous state, one that has served as the cradle of the resistance to Trump’s presidency, had previously accused Trump of declaring war on California.

So it came as somewhat of a surprise last week when Trump took to Twitter to praise Brown — for agreeing to send National Guard troops to the border, as Trump had requested.

“Thank you Jerry, good move for the safety of our Country!” Trump wrote Thursday.

The detente didn’t last long.

On Tuesday, Trump was back on Twitter, taking aim at Brown.

“Looks like Jerry Brown and California are not looking for safety and security along their very porous Border,” Trump said. “He cannot come to terms for the National Guard to patrol and protect the Border. The high crime rate will only get higher.”

What set Trump off was word that California’s National Guard has told Homeland Security officials the state will not allow its soldiers to do the types of things others are doing elsewhere on the border: monitoring surveillance cameras, performing maintenance and transporting U.S. border agents.

Brown has been the only holdout among border state governors, as Texas, New Mexico and Arizona — all led by Republicans — moved quickly to send personnel, in compliance with Trump’s strategy to beef up security until his long-promised border wall is built.

Appearing at an event in Washington on Tuesday, Brown responded to Trump, saying he’s trying to be cooperative.

“There's been a little bit of back and forth, as you always get with bureaucrats,” Brown said. “But I think we can find common understanding here. There's enough problems at the border and the interface between our countries that California will have plenty to do — and we're willing to do it.”

He also suggested it was important to understand the mission.

“Trying to stop drug smuggling,  human trafficking and guns going to Mexico to the cartels — that sounds to me like fighting crime,” Brown said. “Trying to catch some desperate mothers and children or unaccompanied minors coming from Central America — that sounds like something else.”

Brown’s press office, meanwhile, sent out a tweet saying: “Nothing has changed since CA submitted its proposed agreement to the Feds for review - & you thanked us - last week.”

The centerpiece of Trump’s first visit to California as president last month was surveying eight border-wall prototypes on display in a dusty lot near the U.S.-Mexico border outside San Diego. Brown and other California Democrats, who have repeatedly clashed with Trump on immigration policy, saw the move as Trump thumbing his nose at them.

It was during the prototype inspections that Trump lashed out at Brown and his state.

“They have the highest taxes in the United States,” Trump told onlookers. “The place is totally out of control. You have sanctuary cities where you have criminals living in the sanctuary cities.”

The president also noted that he owns property in the state — a home in Beverly Hills and a golf club in Rancho Palos Verdes — and predicted people would start to move out of California because of taxes that are “way, way out of whack.”

Brown responded on Twitter that day, thanking Trump for the “shout-out.”

“California remains the 6th largest economy in the world and the most prosperous state in America,” Brown wrote, adding: “#Facts.”

Trump’s visit came on the heels of a trip the previous week by Attorney General Jeff Sessions to announce that the Trump administration is suing California in an attempt to block its “sanctuary” laws.

Among other things, the administration targeted a provision that bars local authorities from asking about the immigration status of people during routine interactions.

At a news conference in response, Brown said it was unprecedented for an attorney general to “act more like Fox News than a law enforcement officer” and angrily accused the administration of “basically going to war against the state of California, the engine of the American economy.”

Trump then ramped up the rhetoric during his weekly address, accusing California leaders of acting “in open defiance of federal law.”

“They don’t care about crime,” Trump said. “They don’t care about death and killings. They don’t care about robberies. They don’t care about the kind of things that you and I care about.”