Top US Senator John McCain warned the United States on Sunday against negotiating with the Taliban from a position of weakness due to the looming troop pullout in Afghanistan.

The White House confirmed on Thursday that the United States was taking part in an Afghan-led reconciliation process, after President Hamid Karzai said secret three-way talks were taking place with the Taliban. “It’s important to have talks wherever you can, but I also think it’s important to remember that we have to have an outcome on the battlefield that would motivate a successful conclusion to those talks,” McCain said in an interview with ABC News from the Afghan capital Kabul.

“There’s also the perception here that we are leaving, which then, of course, is a disincentive to successful conclusion of the talks,” added McCain, a former presidential nominee and senior Republican figure on foreign affairs. “It’s very important that we have a strategic agreement with Afghanistan for a long-term US presence here,” said McCain, a long-time critic of President Barack Obama’s announced timeline for the withdrawal of US troops.

“I think that’s the best way to bring about a peaceful solution, is to make sure that we are here to stay, to support the Afghan government and people, and we will supply that assistance for as long as is necessary.”