In what's being seen as a hopeful sign in the Afghan peace talks, the Taliban on Tuesday freed two Western hostages who were held for more than three years.

The hostages, both teachers at the American University in Kabul held since 2016, were identified as American Kevin C. King, 63, and Australian Timothy J. Weeks, 50. They were released to American forces as part of a prisoner swap.

“We are so happy to hear that my brother has been freed and is on his way home to us,” King’s sister, Stephanie Miller, said in a statement. “This has been a long and painful ordeal for our entire family, and his safe return has been our highest priority."

King is now said to be with American officials and is receiving medical care ahead of his return to the U.S.

JIM HANSON: COLLAPSE OF PEACE TALKS WITH TALIBAN MAKES CLEAR WE SHOULD DO THIS IN AFGHANISTAN

King's brother-in-law, Joe Miller, said the family is "particularly grateful to members of the Hostage Recovery Fusion Cell, who have supported us through the past three trying years.

"We also want to send the very best wishes to Tim Weeks and his family as they welcome him home," he added.

In exchange for the hostages, Afghanistan released three Taliban members, one of which is Anas Haqqani — the younger brother of the group's military operations leader.

The exchange brokered by American peace envoy Zalmay Khalilzad after he had negotiated a tentative agreement earlier with the Taliban that would have included terms of an American troop withdrawal. However, those talks were ended by President Trump in September.

President Ashraf Ghani said last week the exchange was intended to “facilitate direct peace negotiations” between the Afghan government and the Taliban. He is also hopeful the exchange could nudge the Taliban toward agreeing to at least a partial cease-fire, which would be a precondition to any talks.

The Taliban reportedly has refused to negotiate with Ghani’s government until the United States reaches a troop withdrawal deal with the insurgency.

The American University of Afghanistan said the community "shares the relief of the families of Kevin and Timothy, and we look forward to providing all the support we can to Kevin and Tim and their families.”

TRUMP SCRAPS SECRET MEETINGS WITH AFGHAN, TALIBAN LEADERS AFTER DEADLY BOMBING

The three Taliban prisoners were flown to Doha, Qatar, where the Taliban maintain a political office.

Others included in the exchange included 10 members of the Afghan security forces being held by the Taliban, Afghan and American officials said. Once confirmation of their release was obtained, the final release of the Taliban figures in Doha was to take place, the American official said.

In addition to Haqqani, the Afghan government was to release Hafiz Abdul Rashid, a senior Taliban commander who had equipped suicide bombers, chosen their targets and moved them from safe houses in Pakistan into Afghanistan. Rashid, a brother of a member of the Taliban negotiating team in Doha, was captured along with Haqqani in 2014.

The third Taliban member scheduled to be exchanged was Hajji Mali Khan, a senior commander and an uncle of the deputy leader of the Taliban.

Recovering American hostages held overseas has been a priority for Trump, and his national security adviser, Robert C. O’Brien, was previously the State Department’s top official for managing hostage cases. King’s failing health gave an urgency to the prisoner negotiations, the report said.

ELUSIVE AL-QAEDA LEADER ZAWAHRI MARKS 9/11 ANNIVERSARY BY CALLING FOR JIHADISTS TO ATTACK US, ISRAEL

King was the last known American to be held by the Taliban. Another American who disappeared in Afghanistan, Paul E. Overby Jr., is believed to be dead. Overby disappeared in Khost Province in May 2014 while trying to interview the leader of the Haqqani network.

American officials said the Afghan government and the United States had delayed the swap after two attacks within 24 hours of Mr. Ghani’s initial announcement of the deal on Nov. 12.

Shortly after their abduction in August 2016, Navy SEAL team members attempted to rescue them from a remote compound in eastern Afghanistan but missed them by just hours, officials said. A second rescue attempt, in April, also failed, officials said.

CLICK HERE TO GET THE FOX NEWS APP



The deal also comes at a critical political moment in the country as Ghani is currently embroiled in a divisive presidential election marred by vote-counting delays and charges of ballot-stuffing and voting fraud. The announcement of preliminary election results has already been delayed for weeks.



Meanwhile, the militants did not soften their position against negotiating with the Afghan government after Ghani arranged previous releases of imprisoned Taliban members to mark religious observances. In fact, the insurgents have given up very little over 10 months of negotiations with Khalilzad.

Fox News' Greg Norman contributed to this report.