WASHINGTON — President Obama’s top military adviser said Thursday that he would consider deploying a limited number of United States forces to accompany Iraqi troops on complex offensive operations to retake Mosul and other areas under control of Sunni militants.

Gen. Martin E. Dempsey, the chairman of the Joint Chiefs of Staff, told the House Armed Services Committee that Iraqi troops — who initially fled under the onslaught of Islamic State militants — are now doing a better job of standing and fighting. But he added that he could not foreclose the possibility that as operations against the Sunni militants move into more complex phases of clearing out cities and other areas by the Islamic State, American troops might have to help their Iraqi counterparts.

“I’m not predicting at this point that I would recommend that those forces in Mosul and along the border would need to be accompanied by U.S. forces, but we’re certainly considering it,” General Dempsey said. Defense officials said that American Joint Tactical Attack Controllers could be used to call in airstrikes from tactical positions on the ground, most likely behind Iraqi forces. The tactical attack controllers often deploy in positions like hills and other high terrain so they can see operations and call in strikes.

General Dempsey did say that he did not anticipate expanding the American military presence in Iraq beyond what he called a modest force. “I just don’t foresee a circumstance when it would be in our interest to take this fight on ourselves with a large military contingent,” he said.