The United States and Britain have handed back two huge bases to the Afghan military, 13 years after the American-led invasion launched the long and costly war against the Taliban.
Their departure leaves Afghanistan and its newly installed president, Ashraf Ghani, to deal almost unaided with an emboldened Taliban insurgency after the last foreign combat troops withdraw by year-end.
Afghanistan Ministry of Defence spokesperson General Zaher Azimi said the rest of the foreign forces will hand over other bases in the next two months.
The American and British flags were lowered and folded up for the final time at the regional headquarters of the international military, 13 years after the toppling of the Taliban's radical Islamist regime launched America's longest war.
Camp Leatherneck, in the strategic southern province of Helmand, is the largest US base to be handed over to Afghan control as the coalition ends its combat mission. So far, 2349 US military personnel have died in Afghanistan.
British forces transferred control of adjacent Camp Bastion at the same time.
British defence Secretary Michael Fallon said "mistakes were made" but much had been achieved since troops arrived in 2001.
The number of deaths of British troops throughout the conflict stands at 453.
Camp Bastion, in Helmand Province, has been UK troops' main Afghan base since 2006.
After the withdrawal, the Afghan National Army's 215th Corps will be headquartered at the 28 sq km base, leaving almost no foreign military presence in Helmand.
The US military is leaving behind about $230 million worth of property and equipment - including a major airstrip at the base, plus roads and buildings - for the Afghan military.
"We gave them the maps to the place. We gave them the keys," said Col. Doug Patterson, a Marine brigade commander in charge of logistics.
The province - which produces 80 to 90 per cent of the opium that helps finance the Taliban's insurgency - has seen fierce fighting this year, with Taliban and allied forces seeking to seize the district of Sangin from Afghan army and police.
The battles have raised concerns about whether Afghan forces are truly able to hold off the Taliban without intelligence and air support from the US and its allies.
Officials with the US-led coalition say the Afghan forces held their own this summer fighting season and did not lose any significant ground.