President Obama told a heckler who interrupted a speech on immigration Monday that he will not circumvent Congress and try to halt deportations by executive order because the U.S. is “a nation of laws.”

“Please use your executive order!” shouted the heckler, who was standing behind Obama onstage, close enough to be in the television camera shot during an event in San Francisco’s Chinatown. Urging the president to give immediate relief to those separated from their families at Thanksgiving, he yelled, “You have the power to stop deportations!”

“Actually, I don’t,” Obama responded, asking security personnel not to remove the heckler or other protesters who joined in the shouting. “These guys don’t need to go,” Obama said. “He can stay there.… I respect the passion of these young people.”

But the solution to the problem “won’t be as easy as just shouting,” he said to the young man. “If you’re serious about making that happen, then I’m willing to work with you.”

“The easy way out is to try to yell and pretend like I can do something by violating our laws,” he said. “What I’m proposing is the harder path” of trying to get the law changed.

TIMELINE: U.S. immigration law: Decades of debate

As the prospects for immigration legislation in Congress have faded, activists have been putting increasing pressure on Obama to take executive action to reduce the number of deportations.

Last year Obama approved a step to shield one group of people from deportation, the so-called Dream Act youth, who were brought to the country illegally as young children. The administration justified that action as an exercise in prosecutorial discretion, the legal basis being that the executive branch has authority to say that some cases for deportation are less urgent than others. That principle can’t be extended to cover everyone, administration lawyers have said.

The shouts came at the end of a speech Obama gave as he began a two-day visit to California otherwise dominated by Democratic fundraising events. Obama had used the speech to make a new appeal to Republicans to pass immigration reform before the end of the year.

Obama urged House Republicans to enact changes even if that requires passing several separate measures rather than one comprehensive overhaul package like the one approved by the Senate this year.

“It’s Thanksgiving. We can carve that bird into multiple pieces,” Obama said. “As long as all the pieces get done and we actually deliver on the core values we’ve been talking about for so long, I think everybody’s fine with it.”

Obama had suggested that sort of piece-by-piece approach before but not in such vivid terms.

PHOTOS: The debate over immigration reform

Some House Republicans may be interested in that step-by-step approach if they can finesse the intraparty politics. House Speaker John A. Boehner (R-Ohio) said this week that his caucus is committed to considering immigration legislation, but he did not lay out a time frame. The issue splits Republicans, and GOP lawmakers are divided over the idea of providing a pathway to citizenship for the 11 million immigrants in the country who have overstayed their visas or entered the country illegally.

Obama has insisted that any immigration reform law must include a pathway to citizenship.

“The speaker is sincere in wanting to get something done,” Boehner spokesman Brendan Buck said after the president spoke, “and we’re pleased the president said he can accept the step-by-step approach we’re taking in the House.”

Follow Politics Now on Twitter and Facebook

christi.parsons@latimes.com

Twitter: @cparsons