The Afghan Taliban have freed two Western hostages in exchange for three imprisoned senior militants, officials and Taliban sources say, according to BBC News.

American Kevin King and Australian Timothy Weeks were released three years after being kidnapped outside the American University of Afghanistan in Kabul where they worked as professors.

The three militants arrived in Qatar from Afghanistan as part of the swap.

Afghan officials say the deal is aimed at restarting talks with the Taliban.

President Ashraf Ghani said last week the decision was “a tough, but important” one and a “humanitarian gesture”.

The swap includes Anas Haqqani, a leading figure and fund-raiser in the Haqqani militant group, and two other senior commanders, who had been held in prison by Afghan authorities.

Anas Haqqani’s older brother, Sirajuddin, leads the Haqqani network of fighters and is a deputy leader of the Taliban, which has a political office in Qatar.

Read more:   Russia laws ban 'disrespect' of government and 'fake news'

It is unclear if they have been handed over yet to the Taliban.

The fate of 10 Afghan soldiers who the Taliban are reportedly to free as part of the deal is unclear, the New York Times reported.