KABUL, Afghanistan — The United States and the Taliban have resolved differences in peace talks over the withdrawal of American troops from Afghanistan and guarantees from the insurgents that they will cut ties with other extremist groups, a Taliban official said Tuesday.

The U.S. side did not immediately provide details about the latest round of talks held in Qatar, where the Taliban maintain a political office. But Zalmay Khalilzad, the American envoy who has been leading the talks since they began late last year, tweeted that they had made “excellent progress.”

The two sides have been meeting for the last two days, and technical teams were continuing discussions on Tuesday in Doha. The Taliban official spoke on condition of anonymity because he was not authorized to discuss details of the negotiations.

Khalilzad, who has been tasked with finding a peaceful resolution to the nearly 18-year war — America’s longest conflict — has made intra-Afghan talks and a permanent cease-fire priorities in the negotiations. But the Taliban have continued to sideline the Kabul government, dismissing it as a U.S. puppet and refusing to recognize it.

The Taliban have kept up a near-daily rate of deadly attacks, despite holding several rounds of peace talks with Khalilzad since his appointment almost a year ago. The Taliban now control roughly half of Afghanistan and are at their strongest since 2001, when the U.S.-led invasion toppled their government after it harbored al-Qaida leader Osama bin Laden.

The U.S. and the Taliban now appear to be closing in on an agreement under which U.S. forces would withdraw in exchange for guarantees that Afghanistan would not become a haven for other terrorist groups.

Khalilzad has said he is hoping for a final agreement by Sept. 1 that would allow the roughly 20,000 U.S. and NATO forces to leave.

The U.S. and NATO formally concluded their combat mission in 2014, but the American and allied troops continue to train and build the Afghan military. Separately, U.S. forces also assist Afghan troops in airstrikes and raids on the Taliban and against the Islamic State group’s affiliate in Afghanistan.

President Donald Trump has often expressed his exasperation with America’s continued involvement in Afghanistan and his desire to bring troops home.

Also on Tuesday, the Taliban called on fellow Afghans to boycott next month’s presidential election and warned them to stay away from rallies “that could become potential targets.”

The Taliban dismissed the Sept. 28 election, which has been delayed this year over security and organizational concerns, calling it a “sham.” President Ashraf Ghani, who is seeking a second term in office, is among more than a dozen candidates.

The president’s office issued a statement calling on the Taliban to prove they are serious about peace and “stop intimidating the public.”

In Kabul on Tuesday, a bomb targeted a van carrying employees of the Interior Ministry’s counter-narcotics division. The blast killed five people and wounded another seven, Interior Ministry spokesman Nasrat Rahimi said. No one immediately claimed responsibility for the attack.

___

Gannon reported from New York. Associated Press writer Rahim Faiez in Kabul contributed.