The Taliban insurgents released two Western hostages — Kevin King from the United States and Timothy Weeks from Australia — on Tuesday in a prisoner exchange deal with the Afghan government, two Afghan officials said.

"This morning at around 10am two American University professors were released in Nawbahar district of Zabul province. They were flown out of Zabul by American helicopters," a local police source said.

“The two professors are safely freed and are being taken care of now,” one of the officials said, speaking on condition of anonymity, told Reuters.

The American and Australian were exchanged with three Taliban leaders, including key militant figure Anas Haqqani, added Reuters.

Three Taliban sources in the province also confirmed the release. There was, however, no immediate comment from the US embassy in Afghanistan.

Prime Minister Imran Khan welcomed the release. "We appreciate steps taken by all involved to make it possible. As part of the international community working to bring peace and end the suffering of the Afghan people, Pakistan has fully supported and facilitated this release [...] as part of its policy of supporting initiatives for a negotiated political settlement of the Afghan conflict," he said via Twitter.

"We hope this step gives a boost of confidence to all parties involved to re-engage in the peace process. Pakistan remains committed to facilitating this peace process," he added.

Release and swap

The duo's freedom came hours after the Afghan government freed three Taliban prisoners and sent them to Qatar. The three included Anas Haqqani, the younger brother of the Taliban's deputy Sirajuddin Haqqani, who also leads the fearsome Haqqani network.

It appears the Taliban had refused to hand over the two professors until they received proof their men had reached Qatar.

Afghan President Ashraf Ghani a week ago announced the conditional release of the Taliban figures, saying at a press event broadcast live on state television that it was a very hard decision he felt he had to make in the interest of the Afghan people.

King and Weeks, the two captives held by the Taliban were abducted in 2016 outside the American University in Kabul where they both work as teachers.

The following year, the Taliban released two videos showing the captives. A January 2017 video showed them appearing pale and gaunt. In the later video, King and Weeks looked healthier and said a deadline for their release was set for June 16 that year.

Both said they are being treated well by the Taliban but that they remain prisoners and appealed to their governments to help set them free. It was impossible to know whether they were forced to speak.

Subsequently, United States officials said that American forces had launched a rescue mission to free the two, but the captives were not found at the raided location.

US Secretary of State Mike Pompeo and National Security Adviser Robert O'Brien made separate calls to Ghani on Monday to discuss the prisoners' release, the Afghan president's spokesman Sediq Sediqqi said.

The release and swap were intended to try to restart talks to end Afghanistan's 18-year war and allow for the eventual withdrawal of US troops.

Taliban talks

The US had been close to an agreement in September with the Taliban but a fresh wave of violence in the Afghan capital that killed an American soldier brought talks and an impending deal to a grinding halt.

Read: Pakistan, Taliban favour restart of peace talks

The agreement called for direct talks between the Taliban and Kabul administration, as well as other prominent Afghans, to find a negotiated end to the war and set out a roadmap for what a post-war Afghanistan would look like.

Ghani, in his discussions with Pompeo and O'Brien said he wanted a reduction in violence and an all-out cease-fire, his spokesman said.

According to a US State Department statement on Tuesday, Pompeo told Ghani that Washington was committed to working closely together to address violence if the president's decision does not produce the intended results.