WASHINGTON — For weeks, Capitol Hill has tried to keep America’s military engagement in Iraq at arm’s length: Democrats and Republicans warily backed President Obama’s limited airstrikes against Sunni militants, but nobody — aside from Senator John McCain and a few fellow hawks — demonstrated an appetite for deeper involvement.

Now, though, the gruesome execution of an American journalist, James Foley, has drawn an intensely emotional reaction from lawmakers in both parties, with many issuing statements condemning the Islamic State in Iraq and Syria, the group responsible for Mr. Foley’s killing, and some urging Mr. Obama to redouble the fight against it.

There were signs on Thursday that the Obama administration is weighing that, with the White House and the Pentagon refusing to rule out military action against the group in Syria. But far from satisfying Congress, a wider conflict could put lawmakers, particularly Democrats, in a difficult position, since most deeply oppose any new war in the Middle East.

“Most Democrats and Republicans are extraordinarily wary of being sucked into a large occupation, both because it will kill a lot of Americans and because we saw in Iraq the last time that it didn’t work,” said Representative Adam B. Schiff, Democrat of California and a member of the House Permanent Select Committee on Intelligence.