President Obama decries "anti-immigrant" rhetoric in U.S. politics. (Susan Walsh/AP)

It was as if President Obama had been waiting for the question. A young Hispanic girl, nervously rose to her feet at the end of a long town hall meeting Monday in Des Moines,  and she asked whether the president's plan for two years of free community college extended to "everyone, including illegal students with a good GPA?"

Obama's first answer was essentially to tell her that she didn't qualify.

His second answer seemed to be a direct challenge to Republican front-runner Donald Trump's proposed border wall and the the furor among Republican candidates over "anchor babies,"  a term intended to describe people who immigrate illegally into the United States and give birth here to ensure U.S. citizenship for their child.

"This whole anti-immigrant sentiment that’s out there in our politics right now is contrary to who we are," Obama said to polite applause. "Because unless you are a Native American, your family came from someplace else."

Obama has tried hard to stay out of presidential politics. This time he felt compelled to join the scrum.

A passionate and frustrated president, without naming any of the presidential hopefuls, accused his Republican critics of a hypocrisy that was a betrayal of the country's values and a denial of its history.

"Don’t pretend that somehow 100 years ago the immigration process was all smooth and strict and -- that’s not how it worked," said Obama. "There are a whole bunch of folks who came here from all over Europe and all throughout Asia and all throughout Central America and all -- and certainly who came from Africa, who it wasn’t some orderly process where all the rules applied and everything was strict, and I came the right way. That’s not how it worked.

So the notion that now, suddenly, that one generation or two generations, or even four or five generations removed, that suddenly we are treating new immigrants as if they’re the problem, when your grandparents were treated like the problem, or your great-grandparents were treated like the problem, or were considered somehow unworthy or uneducated or unwashed -- no. That’s not who we are. It’s not who we are."

Next week Pope Francis will visit the the United States and make a stop at the White House, where he's expected to press the United States and other western nations to show more compassion to those fleeing poverty and war. In Iowa, the president made a case that's likely to resonate with the Pope.

"When I hear folks talking as if somehow these kids are different from my kids, or less worthy in the eyes of God, that somehow they are less worthy of our respect and consideration and care -- I think that’s un-American," Obama said. "I do not believe that. I think it is wrong.  And I think we should do better. Because that’s how America was made -- by us caring about all our kids."