WASHINGTON — President Obama said in an interview released Monday that politics in America had become “meaner” than when he took office, but expressed hope that Republicans would eventually turn away from the “expression of frustration” and anger that Donald J. Trump and Senator Ted Cruz were offering to voters.

Speaking to Politico’s Glenn Thrush for the site’s “Off Message” podcast, Mr. Obama said the Republican candidates for president were more outside the mainstream than Senator John McCain was during the 2008 campaign.

“John McCain was a conservative, but he was well within, you know, the mainstream of not just the Republican Party but within our political dialogue,” Mr. Obama told Politico. The president said voters would have to judge “the degree to which the Republican rhetoric and Republican vision has moved, not just to the right, but has moved to a place that is unrecognizable.”

The president’s comments came one week before voters in Iowa gather to caucus in the first presidential voting of the 2016 campaign to succeed him. In the interview, he expressed hope that voters in Iowa and in later contests would “steer back towards the center.”