Updated

Former President Barack Obama hit the campaign trail in California on Saturday, where he struck an optimistic note for Democratic Party activists ahead of November’s midterms -- a day after a speech in which he ripped into President Trump.

“In two months we have a chance to restore some sanity in our politics,” he told the cheering crowd.

Obama introduced congressional candidates at the event, held in Orange County -- a Republican stronghold in the blue state -- and told activists that there was a choice “between those who promote politics of hope and those who exploit politics of fear.”

“During these times of uncertainty, it’s always tempting for politicians for their own gain and for people in power to try and see if they can divide people, scapegoat folks, turn them on each other,” he said.

He also urged activists to push back against lobbyists and special interests: “This is a government for everybody, it’s not for sale, that’s what we believe in.”

While his speech was clearly a partial swipe at Trump, as it had been a day earlier when he had spoken at the University of Illinois, he also warned that the biggest threat to U.S. democracy “is not one individual.”

OBAMA RETURNS TO CAMPAIGN TRAIL WITH FIERY SPEECH; TRUMP COUNTERS, 'I FELL ASLEEP' 

“It’s apathy,” he said.

Obama said he was optimistic about Democrats' chances for flipping the House to their control in November, and said “you can feel the energy” across the country.

He shared the stage with seven candidates in competitive districts across California, races seen as crucial in Democratic efforts to flip the House. Four of the districts are at least partly in Orange County.

Obama didn’t mention Trump by name in his speech, focusing instead on the Democratic candidates with whom he was campaigning.

But on Friday he did name Trump, and said the current president is “a symptom, not the cause.”

“He’s just capitalizing on resentments that politicians have been fanning for years,” he said.

Obama’s speeches mark his return to the campaign trail, where there's the appearance of a sort of presidential duel with Trump. Trump has ramped up his own campaign appearances ahead of the midterms.

In North Dakota on Friday, he brushed off Obama’s barbs, saying they had lulled him to sleep.

"I'm sorry, I watched but I fell asleep," Trump teased, speaking at a political rally minutes later for GOP Senate candidate Kevin Cramer in Fargo. "I found he's very good for sleeping."

At a rally later in the day in Sioux Falls, S.D., for gubernatorial candidate Rep. Kristi Noem, he told supporters, "President Obama made a speech; now if that doesn't get you out to vote for the midterms, nothing will."

The Associated Press contributed to this report.