Turkey is offering to protect Kabul's strategic airport after US forces leave in what experts view as a high-risk bid to improve Ankara's strained ties with Washington.
Keeping the air hub safe from advancing Taliban forces became a major issue after US President Joe Biden called an end to Washington's 20-year involvement by ordering all troops out of Afghanistan by the end of next month.
Hamid Karzai International Airport offers the safest route for embassy staff and humanitarian aid to reach the war-torn country.
Its fall could leave Afghanistan largely cut off from the world.
Ankara's surprise proposal gave Turkish President Recep Tayyip Erdogan a chance to build a rapport with Biden during their first meeting at a NATO summit in June.
The offer meets two of the Turkish leader's objectives: warm chilly ties with Western allies and avert an influx of refugees by keeping aid routes open.
"Turkey has a vested interest in Afghanistan's stability," said Magdalena Kirchner, Afghanistan country director at German foundation Friedrich-Ebert-Stiftung.
Turkish officials play down the diplomatic aspects of the mission and stress the importance of relieving the suffering in Afghanistan.
"Our objective is to make sure Afghanistan is not closed to the outside world, that it is not isolated," a Turkish diplomatic source said.
The United Nations this month said 18 million people - or half the Afghan population - needed assistance, while half of all children under the age of five suffered from acute malnutrition.
While Washington still views Turkey as an important ally in a volatile part of the world, relations have been bedevilled by disputes, including Ankara's acquisition of a Russian missile defence system.
Washington sanctioned Ankara for the purchase last year.
"The main factor behind the airport proposal... is Turkish-American relations: Ankara hopes to regain favour with Washington after a string of diplomatic crises," analyst Salim Cevik wrote in a paper for Germany's SWP think tank.
A security source in Ankara said Turkish personnel have been "operating the airport for the past six years" and would remain past August if an agreement with the US and other countries is reached.
In return, Ankara wants US funding and logistical support, the source added.
The source said some of the discussions concerned the future operations of a US missile defence system currently protecting the airport from air attacks.
"Whatever is needed to operate it, the discussions are on it," the source said.
"We've put it forward that we want to continue our work. We want no combatant duty. We repeat this several times."
Ankara is also talking to the Taliban in the hope of finding an arrangement that could keep Turkish troops from turning into targets for the hardline Islamist movement.
The Taliban has publicly called the idea of a Turkish military presence in Kabul "reprehensible".
"Turkish ambitions to remain engaged despite the US withdrawal appear genuine but carry risks for protection of its own forces, should violence escalate," Kirchner said.
But Erdogan said he was willing to "see where these talks (with the Taliban) take us" and Turkish officials are striking a positive tone.
"In our discussions with the Taliban, they say: 'we trust you, we know you don't have a hidden agenda'," the Turkish diplomatic source said.
Turkey has around 500 soldiers in Afghanistan as part of a NATO-led non-combat mission, whose withdrawal is nearly complete.
The UN refugee agency in 2020 counted 125,104 Afghan asylum-seekers in Turkey, which is already home to 3.6 million Syrian refugees.
Their growing presence could become an emotive issue that the Turkish opposition is trying to exploit to keep Erdogan from extending his rule into a third decade in an election set for 2023.
The main opposition party this month made waves by vowing to send Syrians "back home" and raising the issue of Afghan arrivals in Turkey.
Erdogan struck a deal with the European Union in 2016 under which Turkey agreed to host migrants in exchange for billions of dollars in aid.
Ankara and Brussels are now working on updating the agreement and Afghanistan is already dominating discussions.
"The Europeans are worried," the Turkish diplomatic source said.
A total of 201,437 Afghan migrants were caught in Turkey in 2019. The coronavirus pandemic saw those numbers drop to 50,161 last year and around 29,000 so far this year.
But both EU and Turkish officials agree those number are likely to climb after the US troops leave.-AFP