An American and an Australian who were freed by the Taliban Tuesday after three years in captivity are receiving treatment at a U.S. military hospital in Germany, officials said.

U.S. Ambassador Richard Grenell and Australian Ambassador Lynette Wood met American Kevin C. King and Australian Timothy J. Weeks at the U.S. Air Force's Ramstein after they arrived late Wednesday, a U.S. official said.

FILE: Kidnapped teachers Australian Timothy Weeks, top, and American Kevin King, were abducted at gunpoint in Afghanistan in August 2016. 

FILE: Kidnapped teachers Australian Timothy Weeks, top, and American Kevin King, were abducted at gunpoint in Afghanistan in August 2016.  (AL-EMARA Taliban via AP)

King, 63, and Weeks, 50, were then taken to the nearby Landstuhl Regional Medical Center where they will stay for some time for medical evaluations and a reintegration process.

The two former professors were freed Tuesday in Afghanistan in exchange for three figures in the Taliban-linked Haqqani network: Anas Haqqani, Haji Mali Khan, and Hafiz Rashid.

A Taliban statement that followed the swap – which freed the younger brother of Sirajuddin Haqqani, the head of the Haqqani network – called the exchange a "confidence-building measure" that could help bring an end to Afghanistan's endless war.

King and weeks were abducted at gunpoint outside the American University in Kabul where they worked as teachers. The U.S. State Department said after their release that King and Weeks would both soon be reunited with their families.

2 US SERVICE MEMBERS KILLED IN CHOPPER CRASH IN AFGHANISTAN

Australian Prime Minister Scott Morrison wrote on Twitter that Weeks' family had "asked the Australian government to convey their relief that their long ordeal is over, and their gratitude to all those who have contributed to Tim's safe return."

Grenell told Fox News that he had presented King with an American flag when he met him at Ramstein and told him that "we never forgot about you."

CLICK HERE TO GET THE FOX NEWS APP

Grenell said King then told him: "I know that, and that is what sustained me all these years."

Fox News’ Danielle Wallace and The Associated Press contributed to this report.