Talks to decide the future of US involvement in Afghanistan continued last night, amid tensions over a "military operation" in which American forces "forcibly removed" a senior Taliban commander from an Afghan government convoy.

The US Secretary of State, John Kerry, and Afghan President, Hamid Karzai, are trying to reach a bilateral security agreement which could see thousands of US troops remain long after 2014. But mounting Afghan anger over US actions described by President Karzai as "violations against our sovereignty" remains a major stumbling block.

News of the US capture in eastern Afghanistan of a senior Pakistani Taliban commander, Latif Mehsud, emerged on Friday. It was described as a "military operation" by a US State Department official. "Mehsud is a senior commander in TTP [Tehrik-e-Taliban Pakistan]," the spokesman said. TTP claimed to have carried out the attempted bombing of Times Square in 2010 "and has vowed to attack the US homeland again".

Download the new Independent Premium app Sharing the full story, not just the headlines

The timing of Mehsud's capture on 5 October could not have been worse, as it was the same day that Mr Kerry spoke to President Karzai to arrange the latest talks.

Within days, President Karzai attacked the US for demanding the "freedom to attack our people, our villages" as a condition of signing the agreement. While not mentioning Mehsud, he said: "They commit their violations against our sovereignty and conduct raids against our people ... in the name of the fight on terrorism."

The biggest obstacles to an agreement are Afghanistan's insistence that the US guarantees its security, and its refusal to allow unilateral US missions in Afghanistan – such as hunting down suspected terrorists. Mr Kerry's visit is not to "close a deal", claimed a State Department official on Friday. "The negotiations were going on before he got here; they'll be going on after he leaves."

Mr Kerry remained positive yesterday, saying: "We will try to see if we can make a little more progress." But time is running out, with a deadline of 31 October for a deal to be agreed. If it is not, then the US will abandon Afghanistan entirely at the end of 2014.