US troops being pulled out of Syria will be deployed to western Iraq where they will battle Islamic State terrorists, Defense Secretary Mark Esper said on Sunday.

He did not rule out the idea that the forces would conduct counterterrorism operations from Iraq into Syria, but said that would be worked out in time.

In Iraq, the troops have two missions.

“One is to help defend Iraq and two is to perform a counter-ISIS mission as we sort through the next steps,” Esper told reporters as he traveled to the Middle East, the Associated Press reported. “Things could change between now and whenever we complete the withdrawal, but that’s the game plan right now.”

He said the withdrawal of the troops from northern Syria where they had been leading Kurdish fighters against ISIS will take “weeks not days” and will take place by way of aircraft and ground convoys.

President Trump announced earlier this month that he was pulling all 1,000 troops out of Syria as he tries to extricate US forces from “endless wars” and to bring military personnel home.

Critics said Trump’s decision gave Turkish President Recep Tayyip Erdogan the go-ahead to sweep across the border into northern Syria to attack the Kurds, which Ankara views as a terrorist organization.

Erdogan, after meeting with Secretary of State Mike Pompeo and Vice President Mike Pence last Thursday announced a five-day ceasefire.

Despite reports of that fighting was breaking out in different areas of Syria, Esper said the ceasefire “generally seems to be holding.”

“We see a stabilization of the lines, if you will, on the ground, and we do get reports of intermittent fires, this and that, that doesn’t surprise me necessarily,” he said.

Addressing concerns that ISIS could reform in the chaos, he was asked whether the Kurds and Turks were still controlling the prisons and camps containing ISIS fighters in areas they control.

“I can’t assess whether that’s true or not without having people on the ground,” Espe said.

There are more than 5,000 US troops in Iraq under an agreement between the two countries.