McKenzie announced the Iraq withdrawal during a ceremony for Operation Inherent Resolve, the global coalition to defeat the Islamic State militants, with Iraq’s minister of defense. The decision to reduce the U.S. level to 3,000 troops over the next month was based on conditions on the ground, and has been in the works for months, said defense officials who requested anonymity to discuss future operations.

The news comes as Trump faces backlash over allegations that he called U.S. troops “losers” and “suckers,” and as he trails his opponent, former Vice President Joe Biden, in the polls just weeks ahead of the Nov. 3 presidential election. The announcements also come two days after Trump accused Pentagon leaders of waging wars to ensure contractors “stay happy.”

McKenzie said the force reduction in Iraq is due to “the great progress the Iraqi forces have made and in consultation and coordination with the Government of Iraq and our coalition partners.”

“This reduced footprint allows us to continue advising and assisting our Iraqi partners in rooting out the final remnants of ISIS in Iraq and ensuring its enduring defeat.”

The decision was due to the Iraqi Security Forces’ increased ability to “operate independently,” McKenzie said, stressing that the goal is “an Iraqi Security Force that is capable of preventing an ISIS resurgence and of securing Iraq’s sovereignty without external assistance.”