The Pentagon chief said earlier this week that the troops leaving Syria would reposition to western Iraq to continue fighting the Islamic State. But on Tuesday, he appeared to backtrack, saying that American forces would stay only temporarily.

Iraq’s military opposed the move, saying in a statement that the newly arrived U.S. forces would have to leave.

“There is no agreement for these forces to stay in Iraq,” the statement said.

The dispute added to the turmoil of a rapid U.S. withdrawal from northeastern Syria, where American forces had been allied with Syrian Kurdish fighters battling the Islamic State.