Follow the latest updates on Afghanistan here
Turkey will work with Pakistan to help stabilise Afghanistan and prevent a new throng of refugees, President Recep Tayyip Erdogan said on Sunday.
"Turkey is facing a growing migratory wave of Afghans transiting through Iran," Mr Erdogan said, alongside Pakistani President Arif Alvi.
"We will continue efforts to enable the return of stability in the region, beginning with Afghanistan. To do that, we have to pursue and strengthen our co-operation with Pakistan.
"We are determined to mobilise all the means at our disposal to succeed."
The comments came as the Taliban were poised on the outskirts of Kabul to take power.
The Taliban resurgence comes after a decision by US President Joe Biden to pull out US troops by the end of the month. Nato troops were also withdrawing.
Mr Alvi was in Istanbul for the launch of a naval vessel built by Turkey for the South Asian nation, which shares a border with Afghanistan and is a key regional player.
Turkey has several hundred soldiers in Afghanistan and has offered to take charge of security at Kabul's international airport after the US completes its military withdrawal, provided financial and logistical support are available.
Mr Erdogan has also proposed to meet the Taliban leaders for talks.
Turkey's opposition is pressing the government to take strong measures to stop an influx of Afghan migrants.
The government has responded by increasing construction of a border wall with Iran in recent days.
"With this wall, we will totally stop the arrivals," Mr Erdogan said on Sunday.