Afghan President Hamid Karzai called on the Taliban on Saturday to fight Afghanistan's enemies in what was widely seen as a swipe against Pakistan days after the neighbours' security forces clashed on their border.
Karzai's remarks are likely to unsettle already shaky ties with Pakistan and come as the United States wants Pakistan to help Afghanistan persuade the Taliban to engage in peace talks ahead of the withdrawal of most foreign troops by the end of next year.
"Instead of destroying their own country, they should turn their weapons against places where plots are made against Afghan prosperity," Karzai told reporters in the capital, Kabul, saying this was "a reminder for the Taliban".
"They should stand with this young man who was martyred and defend their soil," he said, referring to an Afghan border policeman who was killed in the Wednesday night clash on eastern Afghanistan's border with Pakistan. Two Pakistani soldiers were wounded.
Hundreds of men took to the streets of the eastern Afghan town of Asadabad on Saturday, near where the clash took place, to protest against both Pakistan and the United States.
A day earlier, thousands of men in Kabul rallied in support of the Afghan security forces.
Afghanistan and Pakistan have had testy relations since Pakistan was formed in 1947, at the end of British colonial rule over India. Afghanistan has never officially accepted the border between them.
Pakistan helped the Taliban take power in Afghanistan in the 1990s. Many Afghan leaders say Pakistan is still helping the militants, seeing them as a tool to counter the influence of its old rival, India, in Afghanistan.
Pakistan denies helping the militants and says it wants peace and stability in its western neighbour.