WASHINGTON — Iran is playing a helpful role against Islamic State militants in Iraq now, but once the extremists are vanquished, Tehran-backed militias could undermine efforts to unify the country, the top U.S. military officer said Wednesday.

Army Gen. Martin Dempsey told lawmakers that any move to counter IS is a ‘positive thing.” But he said there are worries about whether those Shiite militias will later turn against Sunni or Kurdish Iraqis and hamper efforts to bridge ethnic and political divisions that have made peace elusive in Iraq.

“We are all concerned about what happens after the drums stop beating and ISIL is defeated, and whether the government of Iraq will remain on a path to provide an inclusive government for all of the various groups within it,” Dempsey said, using an acronym for the militant group.

The chairman of the Joint Chiefs of Staff said officials are watching to see whether the militias, after recapturing lost ground, “engage in acts of retribution and ethnic cleansing.” At this point, “there no indication that that is a widespread event.”

Dempsey joined Secretary of State John Kerry and Defense Secretary Ash Carter in testifying for more than three hours at a Senate Foreign Relations Committee hearing called to examine President Obama’s proposal for new war powers to fight IS, which holds about one-third of Iraq and neighboring Syria.

The committee chairman, Sen. Bob Corker, R-Tenn., lamented that Obama’s proposal does not give the U.S. military clear authority to defend moderate forces training for the Syrian fight from the bombing risk by troops loyal to Syrian President Bashar Assad.

Dempsey cited “active discussion” about the kind of support “we would supply once the new Syrian forces are fielded.”

Carter later told reporters at the Pentagon that the U.S. will have “some obligation” to support the moderates as they take on IS and face possible attacks from Assad.

“We all understand that,” Carter said. “And we’re working through what kinds of support and under what conditions we would do so, to include the possibility that, even though they’re trained and equipped to combat ISIL, they could come into contact with forces of the Assad regime.”

Carter and Dempsey’s comments opened the door to possible U.S. military action against Assad forces, if needed, to protect moderate rebels during a clash with regime troops.