KABUL — The U.S. special representative for Afghanistan is in Kabul discussing a possible prisoner exchange to free two Western hostages held by the Taliban since 2016, according to two Afghan officials. The move follows U.S. envoy Zalmay Khalilzad’s visit earlier this week to Pakistan, where he was seeking ways to revive peace talks with the Taliban nearly two months after they were upended by President Trump.

Khalilzad is attempting to secure the release of American Kevin King and Australian Timothy Weeks, according to the two Afghan officials, who spoke on the condition of anonymity because they were not authorized to speak to the media. The Australian and American men were professors at the American University of Afghanistan before they were seized at gunpoint in Kabul in August 2016. The officials said the two professors could be freed in exchange for several Taliban commanders, including Anas Haqqani, a son of the founder of the Haqqani network, an insurgent group closely allied with the Taliban.

The Afghan government did not respond to requests for comment. Taliban officials have declined to comment publicly on the possible prisoner exchange. When asked about the possibility earlier this week, Zabiullah Mujahid, a Taliban spokesman, told The Washington Post, “It is not clear yet.”

Also unclear is whether Trump supports the resumption of talks with the Taliban. Trump has repeatedly pledged to bring American troops home from “endless wars” abroad. In October, he authorized a hurried drawdown of U.S. forces from Syria.

Although Trump declared peace talks with the Taliban “dead” in early September, informal “discussions” focused on identifying confidence-building measures have continued behind the scenes, according to a senior Taliban official. The Taliban official spoke by phone from an undisclosed location on the condition of anonymity because he was not authorized to provide information to the media. In early October, Khalilzad met with Taliban leaders.

Other Afghan officials have suggested a reduction in violence is necessary before peace talks can continue. The conflict in Afghanistan has escalated in recent months, and civilian casualties have reached record levels. So far this year, more than 8,000 civilians have been killed or injured, according to the United Nations.

Hamdullah Mohib, the Afghan president’s national security adviser, said in a news conference Monday that the Afghan government is demanding a cease-fire before any peace talks with the Taliban. The announcement marks a sharp departure from the government’s previous position of openness to direct talks without preconditions.

Mohib said a cease-fire would be a test of the Taliban’s ability to control its fighters.

Suhail Shaheen, the spokesman for the Taliban’s political office in Doha, Qatar, responded, “The accusation of disparity and division among our rank and file is an empty claim made by the spoilers of the current peace process.”

The Taliban has long refused to meet directly with the Afghan government, even without preconditions, as the insurgents view Afghan President Ashraf Ghani’s government as a puppet of the United States.

In Pakistan, Khalilzad met with Prime Minister Imran Khan and held talks with the country’s powerful military chief earlier this week.

Khalilzad’s Kabul visit comes amid continuing political uncertainty in Afghanistan, where the results from the country’s recent presidential election remain in limbo. Afghanistan’s Independent Election Commission has delayed the announcement of the results until mid-November. Afghans voted Sept. 28 in polls that had been repeatedly delayed by security concerns.

Khalilzad and Taliban negotiators appeared to be days away from announcing a peace deal in September before the effort was halted by a tweet from Trump. The deal included an agreement on the withdrawal of most American troops from Afghanistan in exchange for a pledge from the Taliban that it would not harbor terrorist groups. It is not clear whether any further talks moving forward would pick up where the negotiators left off or begin the process from scratch.

When asked about the resumption of peace talks, Shaheen, the Taliban spokesman in Qatar, said the deal that U.S. and Taliban negotiators reached in September “contains answers to all issues,” adding: “It only needs signing and implementation.”

The last time the Taliban and the Afghan government agreed to a cease-fire was in June 2018, the first since the conflict began. The truce, initially declared by Ghani’s government, was part of an urgent bid for peace with the Taliban when the group’s battlefield strength was on the rise. The two sides have been unable to agree to another cease-fire.

Sayed Salahuddin in Kabul and Haq Nawaz Khan in Peshawar, Pakistan, contributed to this report.