Hundreds of Taliban inmates that are set to be released as a precondition to peace talks with Kabul pose a danger "to the world", Afghan President Ashraf Ghani said Thursday.

Ghani's government is due to meet with the Taliban in Doha in the coming days for the two sides' direct talks aimed at ending nearly 19 years of war.

They are set to meet once Kabul has released 400 Taliban prisoners in a move that has drawn widespread condemnation after it emerged many of the inmates were involved in attacks that killed scores of Afghans and foreigners.

"Until this issue, there was a consensus on the desirability of peace but not on the cost of it," Ghani said in a videoconference organised by a US think tank.

"We have now paid the major instalment on cost and that means peace will have consequences," he added, noting that the release of "hardened criminals" and drug dealers was "likely to pose a danger both to us and to (America) and to the world".

The freeing of the 400 prisoners comes after Kabul already released about 5,000 lower-risk Taliban inmates.

Afghan authorities said Monday they would begin releasing within two days the 400 prisoners -- but there was no sign of that late Thursday.

Speaking on condition of anonymity, an Afghan government official told AFP the prisoners were being held until the Taliban first release several Afghan commandos still in their custody.

If the Taliban release the commandos Friday, Kabul would reciprocate by releasing many of the 400 insurgents, the official said.

Ghani said the Taliban must find common ground in upcoming talks.

Afghan President Ashraf Ghani warned that the country was paying a major instalment on the cost of peace by releasing 400 Taliban prisoners
Afghan President Ashraf Ghani warned that the country was paying a major instalment on the cost of peace by releasing 400 Taliban prisoners Press Office of President of Afghanistan / HANDOUT

"The Taliban cannot look for dominance," he told the Washington-based Council on Foreign Relations.

"If they look for dominance, you know Afghan society ... will not accept dominance."

Under a deal signed with the US in February, the Taliban are required to begin talks with Kabul and discuss a permanent ceasefire.

But the insurgents have given no indication they will compromise with Kabul and insist they will return Afghanistan to an Islamic "emirate," as it was when they ruled in the 1990s.

"The burden of history and the initiative now lies with the Taliban," Ghani said.

"How they talk, how they deal, how they frame the issues and do they search for common ground."

The president suggested the talks could run for a long time.

Using an old saying attributed to the Taliban, Ghani said Afghan negotiators can take as long as is needed to get a fair peace settlement.

"Unlike in their relations with the US where (the Taliban) said they had the time and (Washington) the clocks, the rest of the Afghans have time. ... That changes the nature of negotiations," Ghani said.

"This time has to either be used productively which all of us are praying for, or it can turn into destruction."