1 of 3
Tony Avelar, Associated Press
President Barack Obama holds 3 month-old Charlie Allsup as he meets with the crowd before departing on Air Force One at Moffett Federal Airfield Thursday, Feb. 11, 2016, in Mountain View, Calif.

ATHERTON, Calif. — President Barack Obama said Thursday that "strange things" can happen in politics when voters are scared and that the angst people are feeling across the country is finding voice in both the Republican and Democratic parties.

"We have to listen to that," Obama said at a Democratic Party fundraiser at the San Francisco-area home of supporter and venture capitalist Steve Westly.

Obama commented two days after billionaire businessman Donald Trump rode that wave of voter anger at traditional politicians to a commanding win in New Hampshire's Republican presidential primary. Vermont Sen. Bernie Sanders did the same in the state's Democratic primary, trouncing longtime front-runner Hillary Clinton by double digits.

Obama said the country is in "an interesting political moment" and that it's still early in the process for choosing the presidential nominees.

He said "what is true is that people are anxious" despite the progress that's been made since he took office seven years ago.

Obama said people remember the dire economic straits the country faced at the dawn of his presidency, when the economy shed hundreds of thousands of jobs and people were losing their homes and retirement savings. He said people are concerned about income inequality and laboring under a political system they believe works against their interests.

"That concern is expressing itself in the Republican Party as well as in the Democratic Party and we have to listen to that," Obama told several hundred people gathered in the sloping backyard of Westly's home in Atherton, California. "Because when people are scared, strange things can happen in politics."

"We can get a politics that's not about bringing people together," Obama said.

He said the country never moves forward "when it's based on us and them. It moves forward when it's based on us. Period."

Obama's comments were aimed at making sure Democrats don't take anything for granted this fall, White House spokesman Eric Schultz told reporters on Air Force One after the fundraiser.

"When there is frustration in Washington, that animates the electorate," Schultz said. "What he wants to do is lay out the choice that voters will face."

Obama was raising money for his fellow Democrats at four California fundraisers on Thursday, including a private event benefiting the campaign arm for Democratic Senate candidates. Two fundraisers are scheduled for Thursday afternoon in Los Angeles, including one at which Grammy Award-winning singer John Legend is scheduled to perform.

Follow Darlene Superville on Twitter: http://www.twitter.com/dsupervilleap