Freed Taliban captive in good spirits

Australian Tim Weeks has been released after the Afghan government freed three Taliban prisoners

The Australian academic who was held by the Taliban for three years is in good spirits, according to the prime minister.

Tim Weeks and his American colleague Kevin King were released by the fundamentalist group overnight on Wednesday.

While his family have asked for privacy, Prime Minister Scott Morrison said Mr Weeks had endured "three years of absolute hell" but was in good spirits.

"Tim is in a safe place, he's out, and he's coming home," Mr Morrison told reporters on Wednesday.

"We look forward to that very, very much."

Mr Weeks' family said they were grateful for the Australian government's role in securing his release, as well as the United States and Afghanistan.

"We thank our friends and extended family for their love and support over the past three years during this very difficult time," the statement said.

Mr Weeks, 50, and Mr King, 63, were freed in a deal brokered by the Afghan government and the United States.

They were kidnapped outside the American University in Kabul in 2016,

The pair were exchanged for three members of the Taliban's Haqqani network, an offshoot of the group responsible for several deadly attacks and suicide bombings in Afghanistan.

Mr Morrison thanked the Afghan and the US governments for their roles in securing Mr Weeks' release.

Labor's foreign affairs spokeswoman Penny Wong was relieved both Mr Weeks and Mr King have been released.

"We share the hope that this release will build positive momentum for meaningful dialogue and a durable peace in Afghanistan," she said