The Taliban have asked Turkey for technical help to run Kabul airport after the departure of foreign forces but insist that Ankara's military also withdraw fully by the end-August deadline, two Turkish officials said. But President Tayyip Erdogan's government has said for months that it could keep a presence at the airport if requested. After the Taliban seized control of the country Turkey offered technical and security assistance at the airport.
Ankara had been hoping to gain a foothold in Kabul after the US troop withdrawal is completed on Tuesday.
But the Taliban's swift capture of the Afghan capital left those plans in disarray, eliminating a key point of leverage in its tumultuous relations with the United States.
Taliban sought Ankara's support to run Kabul airport
"The Turkish Armed Forces are returning to our homeland with the pride of successfully fulfilling the tasks entrusted to it," the Turkish defence ministry said in a statement.
Turkey had more than 500 non-combat troops stationed in Afghanistan as part of Nato's now-abandoned mission in the war-torn country.
Turkish President Recep Tayyip Erdogan said Ankara was still interested in playing a role in Afghanistan, keeping its lines of communication open with Taliban leaders.
"It is important for Afghanistan to stabilise," Erdogan said as the troop withdrawal was announced.
"Turkey will continue to be in close dialogue with all parties in Afghanistan in line with this goal." The Turkish defence ministry also left open the option of playing a security role in Kabul down the line.
"Turkey will continue to be with the Afghan people as long at they want," it said, noting the troops had been stationed at the airport for the past six years.
The conditional request by the Islamist Taliban, who swept back to power in Afghanistan 20 years after they were ousted in a US invasion, leaves Ankara with a difficult decision over whether to accept a hazardous job, one official said.
"The Taliban have made a request for technical support in running Kabul airport," a senior Turkish official said, adding however that the Taliban demand for all Turkish troops to leave would complicate any prospective mission.
"Ensuring the safety of workers without the Turkish Armed Forces is a risky job," he said, speaking on condition of anonymity.
Talks with the Taliban on the issue were ongoing and, in the meantime, preparations for a troop withdrawal had been completed, he said.
It was unclear whether Turkey would agree to give technical assistance if its troops were not there to provide security.