President Joe Biden announced Monday that he would formally end the U.S. combat mission in Iraq by the end of the year. The move comes just after Biden said he would withdraw troops from Afghanistan, bringing an end to America’s longest war.

The plan is to shift the U.S. military away from combat and gear its efforts towards advisory and training roles. Iraqi security forces are “battle-tested” and have proven themselves “capable” of protecting their own country.

The White House has stated that it still recognizes the threat ISIS brings to Iraq. The terrorist group recently claimed responsibility for an attack that killed at least 30 and wounded dozens in a suburban Bagdhad market.

Both the U.S. and Iraq came to an agreement in April that a train-and-advise mission would end the U.S. combat role in Iraq.

The war in Iraq began in March 2003 under the George W. Bush administration. According to the Department of Defense casualty website, there were 4,431 total military deaths and 31,994 wounded in action as part of Operation Iraqi Freedom. IraqBodyCount.org estimated the documented Iraqi civilian deaths from violence at between 185,761 and 208,877.

Former President Barack Obama initially pulled out of Iraq in 2011 but re-entered the country in 2014 in order to combat the growing threat of ISIS in large portions of western, and northern Iraq. Former President Donald Trump had also reduced the troop levels from 3,000 to 2,500 during his time in office.

Iraqi Prime Minister Mustafa al-Kadhimi said it is time for the U.S. to conclude its combat operations in Iraq. “There is no need for any foreign combat forces on Iraqi soil,” he told reporters.

Al-Kadhimi could use these negotiations to help his campaign, as Iraqi parliamentary elections are less than three months away.

Biden, alongside Al-Kadhimi, told reporters in the Oval Office that the U.S. mission in Iraq will shift.

“Things are going well, our role in Iraq will be to assist, to train, to help, and to deal with ISIS as it arrives. But we’re not going to be, by the end of the year, in a combat mission,” Biden said.

“We support strengthening Iraq’s democracy and we’re anxious to make sure the election goes forward in October. We’re also committed to our security cooperation, our shared fight against ISIS. It’s crucial for the stability of the region and our counter-terrorism cooperation will continue, even as we shift to this new phase we are going to be talking about,” Biden said.

Biden’s latest move will not be a complete withdrawal of the 2,500 U.S. troops stationed in Iraq, unlike his plans to withdraw from Afghanistan by Aug. 31. The administration has not stated when a complete withdrawal will take place.