WASHINGTON — Tempering expectations, the Trump administration’s peace envoy for Afghanistan said Friday that although his talks with the Taliban have produced a tentative “framework” agreement, negotiations are far from finished.

The envoy, Zalmay Khalilzad, said he hopes a final deal is clinched before Afghanistan’s presidential election in July. But he also stressed that many issues remain to be resolved and that it must be a package deal.

“We are in the early stage of a protracted process,” he said in remarks at the United States Institute of Peace, adding, “We have a long way to go.”

The envoy, who is a former U.S. ambassador to Kabul, also called for direct talks to begin as soon as possible between the Taliban and the Afghan government, which thus far has not been involved in Khalilzad’s talks. But he noted that the Taliban have been unwilling to take this step, arguing that the government is illegitimate.

Zalmay, who was appointed in September as the State Department’s special representative for Afghan reconciliation, said that although he and the Taliban have made progress on the issue of a U.S. troop withdrawal, that is just one among many issues and none has been fully resolved.

“My overall goal is, at the direction of the president and the secretary of state, not to seek a withdrawal agreement but a peace agreement,” he said.

The U.S. has about 14,000 troops in Afghanistan, and President Donald Trump has indicated he wants a substantial withdrawal this year, although no such orders have been given, according to U.S. military officials.

Khalilzad said the U.S. is not seeking permanent military bases in Afghanistan and will leave if Kabul does not want U.S. troops there, “provided that there is no threat to our national security from Afghanistan, that there are not terrorist threats from Afghanistan to the United States — that is a red line, and I think that’s the policy of the president as well.”

U.S. troops invaded Afghanistan in October 2001 and toppled the Taliban government within weeks. The U.S. military turned its attention largely to Iraq in 2003, and eventually the Taliban were able to regenerate enough combat power to contest key battlefields, mainly in the south. The war is now considered a stalemate.

WATCH: U.S. and Taliban peace talks make progress toward ending war in Afghanistan

Getting American troops out of Afghanistan, where they have been either fighting the Taliban or advising Afghan government forces since October 2001, is the top priority for the Taliban officials he has talked with, Khalilzad said. The main U.S. objective, he said, is ensuring that Afghanistan never again becomes a haven for extremists like al-Qaida, the group led by Osama bin Laden that launched the 9/11 attacks from Afghanistan.

“After many conversations, we have reached an agreement in principle with the Taliban on a framework that would provide guarantees and an enforcement mechanism that no terrorist group — international terrorist group or individual — would be able to use Afghanistan” as a platform for international terrorism, he said. He added that more talks are planned to “flesh out” the Taliban’s commitments.

Zalmay Khalilzad said he hopes a final deal is clinched before Afghanistan’s presidential election in July.

Critics have questioned the wisdom of accepting any Taliban assurances against collaboration with al-Qaida, and Khalilzad did not explain how Washington would ensure that any such arrangement were effective.

“We will not just rely on people’s words,” he said, adding that there would have to be “enforcement mechanisms,” which he did not define. “Words are not enough,” he said.

Khalilzad said the U.S. and the Taliban have worked out a “framework” for a “possible U.S. withdrawal as part of a package deal.” Even if the troop withdrawal and Taliban assurances on denying haven to extremist groups were fully settled, F would not be completed until numerous other issues such as political participation are decided, he said.

“Nothing is agreed to until everything is agreed to,” he said.

Khalilzad said he sees himself as a “catalyst,” to find a formula for Afghans to sit down with each other and work out a roadmap for a peaceful future. He said he wants those intra-Afghan negotiations to start immediately.

He said the Taliban are unwilling to negotiate with the Afghan government, but added there are “indications” that they would be willing to do so in a “multiparty arrangement.”

While the U.S. talks with the Taliban have focused on troop presence and assurances that terrorist networks would not be given haven, Khalilzad said intra-Afghan talks could also deal with human rights, freedom of the press and the role of women, who were harshly oppressed under Taliban rule.

“They (the Taliban) say they made a mistake in how they dealt with women the last time,” Khalilzad said. “But nevertheless, they’re not going to be the government of Afghanistan. They are going to be part of the political process of Afghanistan. They may be part of a power-sharing arrangement in Afghanistan.”

Khalilzad said he has pressed the Taliban to agree to a permanent ceasefire as a step toward ending the war, but they have resisted, arguing that it would remove their leverage and reduce the Afghan government’s incentive to make concessions in direct negotiations. They also contend that a long ceasefire would make it difficult to get their troops back into the field if the halt to violence came to an end. But he said there are ongoing discussions about arranging some sort of ceasefire.

Associated Press writer Deb Riechmann contributed to this report.