Afghan President Hamid Karzai, who most Western governments want to see win an election on October 9, said on Saturday that foreign troops would remain until the country's own fledgling forces can take the charge of stability.
There are over 17,000 foreign troops under US military command in Afghanistan, hunting officials of the former Taleban regime and members of the Osama bin Laden's al Qaeda network, the architects of the September 11 attacks on the United States.
Another 8,000 NATO-led peacekeepers are mainly stationed in the capital Kabul.
"Even now we have only managed to keep them here with thousands of pleadings and lamentations," Karzai told an election rally in the capital.
"They will go when we have a powerful army," he added.
Karzai, installed as interim president after the US-led invasion overthrew the Taleban, relies extensively on foreign bodyguards for his own personal protection.
He survived an assassination attempt just last week when a rocket was fired at his helicopter as he prepared to land on a campaign trip south of the capital.
Asked during Saturday's rally how long foreign troops would remain in Afghanistan, Karzai said they were here only temporarily, but would remain as long as necessary.
Since the Taleban's fall, the US has been leading efforts to reform and retrain the Afghan National Army that is now about 14,000 strong.
Germany has taken responsibility for training the Afghan police force, which has about 20,000 personnel.
The rebuilding of the force has been slow and some Afghans look with suspicion on the process, believing the US favours a weak Afghan army as justification for retaining its presence.
Karzai faces 17 opponents in next month's election - the first ever direct Afghan presidential vote.