The top U.S. commander in the Middle East announced in Baghdad Wednesday that 2,200 U.S. troops will withdraw from Iraq by the end of this month.

Marine Gen. Frank McKenzie made the announcement alongside the Iraqi Minister of Defense as a sign that the troop reduction decision was made in consultation with the government of Iraq.

“The United States has decided to reduce our troop presence in Iraq from about 5,200 to 3,000 troops during the month of September," McKenzie said.

TRUMP, PENTAGON SET TO ANNOUNCE PLAN TO WITHDRAW MORE US TROOPS FROM IRAQ

"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," he added.

In this Jan. 31, 2020, file photo, Marine Gen. Frank McKenzie, center, top U.S. commander for the Middle East, makes an unannounced visit in Kabul, Afghanistan. Six months after a deadly American airstrike in Baghdad enraged Iraqis and fueled demands to send all U.S. troops home, McKenzie is talking optimistically about keeping a smaller, but enduring military presence in Iraq. (AP Photos/Lolita Baldor, File)

In this Jan. 31, 2020, file photo, Marine Gen. Frank McKenzie, center, top U.S. commander for the Middle East, makes an unannounced visit in Kabul, Afghanistan. Six months after a deadly American airstrike in Baghdad enraged Iraqis and fueled demands to send all U.S. troops home, McKenzie is talking optimistically about keeping a smaller, but enduring military presence in Iraq. (AP Photos/Lolita Baldor, File)

The long-planned decision means more than 40% of U.S. troops will exit Iraq in the next three weeks.

The withdrawal announcement Wednesday was a coordinated effort between the Pentagon and President Trump, who has pledged to exit "endless wars." Trump has hit Democratic opponent Joe Biden for his vote in favor of the Iraq War in 2002 as a member of the U.S. Senate and has campaigned on getting the U.S. military out of the Middle East.

TRUMP TO AWARD MEDAL OF HONOR ON 9/11 TO SOLDIER WHO RESCUED 75 HOSTAGES

“Unlike previous administrations, I have kept America out of new wars and our troops are coming home," Trump said last month while accepting the Republican presidential nomination at the White House.

U.S military officials have already announced that they plan to reduce troops in Afghanistan down to about 4,000 or 5,000 from current levels. That announcement is expected to come from the president in the coming days.

There will be no immediate change to the approximately 600 U.S. troops currently in Syria, a senior defense official told Fox News.

McKenzie highlighted the partnership between the U.S. and Iraqi forces and said the withdrawal decision was possible because of "our confidence in the Iraqi Security Forces’ increased ability to operate independently."

The "ultimate goal" is for Iraqi forces to be capable of "preventing an ISIS resurgence and of securing Iraq’s sovereignty without external assistance," he said.

It's been a long and costly journey for the American military in Iraq. U.S. troops invaded Iraq in 2003 under President George W. Bush.

In 2007, at the height of the Iraq War, the U.S. had approximately 170,000 troops in Iraq and over 750 were killed in action.

CLICK HERE TO GET THE FOX NEWS APP

President Obama declared an end to the Iraq War in 2011 but then sent troops back to Iraq in 2014 to fight ISIS.

This will be the first time U.S. troops have been withdrawn from Iraq since 2016.

"The journey has been difficult, the sacrifice has been great, but the progress has been significant," McKenzie said.