Afghanistan is to release three high-ranking Taliban prisoners in exchange for two hostages held by the group, President Ashraf Ghani has said.
American Kevin King and Australian Timothy Weeks were lecturers at the American University of Afghanistan when they were kidnapped in 2016.
Anas Haqqani, a leading figure in the Haqqani militant group, and two other senior commanders are part of the deal.
It is unclear how or when the exchange of prisoners will take place.
"In order to pave the way for face-to-face negotiations with the Taliban, the government has decided to free Taliban prisoners in exchange for two university professors," Mr Ghani said in a televised speech.
There was no immediate response to the announcement from the Taliban, who have long refused to negotiate with Mr Ghani's administration.
The two professors were ambushed by gunmen and taken from a vehicle while leaving their university campus in Kabul in August 2016.
The pair then appeared in a video, released in January 2017, appealing to then US President-elect Donald Trump to agree to a deal to secure their release.
The exact condition of the two men remains unclear, but in his speech Mr Ghani noted "their health has been deteriorating while in the custody of the terrorists".
Mr Ghani said the decision to conditionally release the prisoners was "a tough, but important decision" and a "humanitarian gesture".
Anas Haqqani's older brother, Sirajuddin, leads the Haqqani network of fighters and is a deputy leader of the Taliban.
The Haqqani network has been behind many of the co-ordinated attacks on Afghan and Nato forces in recent years and has been blamed for some of the deadliest blasts in the country, including a truck bomb in Kabul in 2017 that killed more than 150 people.
Pakistan has been accused by the West of backing the Haqqani network to counter the influence of arch-rival India in Afghanistan, a charge it denies.
Anas Haqqani was captured in 2014 alongside another commander, Hafiz Rashid, who is also set for release.
The other militant involved in the swap was named as Haji Mali Khan, who is reportedly an uncle of Sirajuddin Haqqani, the AFP news agency reports.
The Afghan government was shut out of negotiations between the US and the Taliban earlier this year.
In September President Trump declared that effort "dead", shortly after cancelling secret plans to host a Taliban delegation at Camp David in the US.
Swap shows concessions
Analysis by Auliya Atrafi, BBC Afghan in Kabul
President Ghani's confirmation of this prisoner swap came as no surprise, as negotiations behind the scenes have been happening for some time.
Until now, he had made clear that the release of Haqqani Network members was a red line for his government, but it now seems the president is willing to make a range of concessions to the Taliban if it paves the way to direct peace talks.
For some it's a move by the Afghan government to try to appease, in exchange for including it in peace talks in which the National Unity Government has so far been kept out.
But the Taliban have previously made clear that foreign forces have to withdraw before they start intra-Afghan talks. Even then, the Taliban say, they will only treat the Afghan government as a part of the conflict and not as a state.