The military's top officer said Wednesday that American military boots on the ground may eventually be needed in Syria to fight alongside moderate Syrian rebel groups.

Army Gen. Martin Dempsey, the chairman of the Joint Chiefs, testified on Capitol Hill that military commanders may consider the need for small teams of U.S. troops to help local Iraqi and Syrian forces if that is critical for defeating the Islamic State militants.

"If the commander on the ground approaches either me or the secretary of defense and believes that the introduction of special operations forces to accompany Iraqis or the new Syrian forces, or JTACS, these skilled folks who can call in close-air support, if we believe that's necessary to achieve our objectives, we will make that recommendation," Dempsey told the House Appropriations Committee's defense panel.

For months, the U.S. strategy for fighting the militants has focused on Iraq, where about 2,700 U.S. troops are running an advise-and-assist mission training Iraqi security forces to fight the Islamic State militants, also known as ISIL or ISIS.

The U.S. and its coalition partners are hitting ISIS targets in Syria with airstrikes but have no strong allies on the ground.

Now more attention may be shifting toward Syria, where an American-led training program is getting underway. The U.S. and its coalition partners have screened at least 1,200 moderate Syrian rebels who could become recruits for the training effort based at facilities in Turkey, Saudi Arabia and Qatar, Pentagon officials say.

The fight against the Islamic State in Syria is uniquely complex because the U.S. opposes both ISIL as well as the government and its forces. ISIL controls numerous Syrian cities and is waging its own fight against the Syrian regime of Bashar al-Assad.

Defense Secretary Ash Carter told lawmakers Wednesday that the "Syria piece" is a "much more difficult situation wherein we're trying to create a third force that can both combat ISIL and set the conditions for the eventual removal of Bashar Assad."

A spokesman for Dempsey downplayed the chairman's comment about potential deployment of troops in Syria.

"It was a hypothetical and there is no consideration of sending U.S. troops into Syria beyond personnel recovery/combat rescue forces if necessary as the air campaign continues," said Air Force Col. Ed Thomas, a spokesman for the Joint Staff.