FILE - In this Jan. 18, 2017 file photo, President Barack Obama speaks during his final presidential news conference, in the briefing room of the White House in Washington. A spokesman for Obama says the former president "fundamentally disagrees" with discrimination that targets people based on their religion. The statement alluded to but did not specifically mention President Donald Trump's temporary ban on refugees from several Muslim-majority countries. (AP Photo/Pablo Martinez Monsivais, File)

WASHINGTON (AP) — Former President Barack Obama praised protesters who amassed across the country in opposition to President Donald Trump’s immigration orders, breaking his silence on political issues for the first time since leaving office.

“The president fundamentally disagrees with the notion of discriminating against individuals because of their faith or religion,” Obama’s spokesman, Kevin Lewis, said.

In his first statement on behalf of the former president, Lewis said Obama was “heartened” by the amount of engagement taking place in U.S. communities. Lewis, a former White House official, pointed out that Obama used his last official speech as president to talk about Americans’ responsibility to be “guardians of our democracy,” even in nonelection years.

“Citizens exercising their constitutional right to assemble, organize and have their voices heard by their elected officials is exactly what we expect to see when American values are at stake,” Lewis said.

Trump said he took cues from Obama by temporarily banning travel to the U.S. from citizens of seven countries that Obama’s administration identified as places of terrorism concern. But Obama’s designation related strictly to eligibility to enter the U.S. without a visa; he never considered a travel ban.

Obama’s office also circulated excerpts from a speech the former president gave in November 2015, in which he called the idea of a ban on Muslims “shameful.”

“That’s not American. That’s not who we are. We don’t have religious tests to our compassion,” Obama said in the aftermath of attacks in Paris that prompted calls for the U.S. to restrict Syrian refugees from entering the United States.

Trump and the White House have vigorously disputed the notion that Trump’s order is a “Muslim ban.” Trump’s halts all refugee admissions for 120 days, suspends the Syrian refugee program indefinitely and also suspends entry to the U.S. from seven majority-Muslim countries for 90 days. But the White House has stressed that dozens of other Muslim-majority countries aren’t included.

Lewis’ comments mark the first time Obama has weighed in on Trump’s actions since Obama left office on Jan. 20. In his final weeks as president, Obama said he planned to follow George W. Bush’s example by giving his successor room to govern without being second-guessed.

Yet Obama pointedly reserved the right to speak out if Trump violated what Obama called basic American values. He suggested a ban on Muslims or a move by Trump to deport immigrants brought to the U.S. illegally as children would cross that threshold.