Kabul: The US and Afghanistan are nearing agreement to rewrite key aspects of their plan for ending US military involvement in the war against Taliban and Al Qaida fighters in Kabul, US and Afghan officials said Saturday.

In a joint appearance, Afghan President Ashraf Gani and visiting US Defense Secretary Ashton Carter acknowledged that they are rethinking the pace of the US military withdrawal, the scope and frequency of US counterterrorism raids, and whether they should keep US bases open longer than projected. Although they declined to offer more specifics, they indicated that a new deal could be reached as soon as next month, when Gani is scheduled to visit Washington to meet with President Barack Obama.

Afghan officials and US military commanders have previously acknowledged pressing Obama for more leeway in determining how quickly the remaining 10,600 US troops in Afghanistan are withdrawn over the next two years. But the comments on Saturday by Gani and Carter were the clearest sign yet that changes are afoot.

“President Obama is considering a number of options to reinforce our support for President Gani’s security strategy, including possible changes to the timeline for our drawdown of US troops,” Carter told reporters. “Our priority now is to make sure this progress sticks.”

The US military ended conventional combat operations in Afghanistan on December 31. American troops remain in the country to train and advise about 350,000 Afghan security forces in their fight against the Taliban.

US troop levels are currently scheduled to dwindle to 5,500 by the end of this year and to drop to zero by the time Obama leaves office in early 2017, save for a small residual force based at the large US Embassy compound in Kabul.

US military commanders, however, have sought more flexibility in drawing down troop levels over that period as well as broader latitude to conduct counterterrorism raids and air strikes against Taliban and Al Qaida targets.

Gani said he was “gratified” by a recent Obama directive that temporarily kept an extra 1,100 troops in Afghanistan. But he indicated he would not try to lobby Obama to change his mind about completing the US military pullout by the end of his term, saying he “respected” Obama’s decision.

“Our relationship is not defined by the number of troops, but by the comprehensive nature of the partnership,” he added.

Carter took office as defence secretary less than a week ago, but he said this was his 10th visit to Afghanistan during his long career as a Pentagon official.

Standing next to Gani at the Afghan presidential palace, Carter called counterterrorism a “continuing preoccupation” and said both sides were “rethinking the details of the counterterrorism mission and how the environment has changed here”.

Carter shied from giving specifics, but other US officials noted the recent emergence of a small number of Afghan militants allying themselves with the Daesh movement based in Syria and Iraq.

Army Gen. John Campbell, the commander of US and Nato forces in Afghanistan, said a few former Taliban commanders have “rebranded” themselves as fighters for Daesh, noting that one was killed in a US air strike in Helmand province this month. Although he described the trend as “nascent,” he said US officials recognised how quickly Daesh has been able to attract followers elsewhere.

“You saw how fast this went in Iraq,” Campbell told reporters at a separate press conference. “All of us don’t want that to happen here.”

Campbell and Carter lauded Gani for bringing a measure of political stability to Afghanistan since forming a unity government with Abdullah Abdullah last fall and for his eagerness to work closely with US military officials. Gani’s predecessor, Hamid Karzai, had a thorny relationship with the Obama administration and frequently spoke out against the presence of foreign troops in Afghanistan.

“The most important factor influencing our thinking is the change represented by the unity government,” Carter said, “and what that means for the promise of certainty, predictability and progress that just a few months ago we couldn’t have planned on.”

Added Campbell: “The difference where we are with Karzai and where we are today is night and day.”