The US announced an agreement with the Iraqi government Friday to wrap up the military mission in Iraq of an American-led coalition fighting the Islamic State group by next year, with US troops departing some bases that they have long occupied during a two-decade-long military presence in the country.