Afghan troops have torn down part of a new anti-Taleban fence being erected by Pakistan on the border between the two countries, officials in Kabul say.
Pakistan says the border fence is vital to stop militant incursions
They say the move led to fighting between Afghan and Pakistani troops.
But Pakistan has denied the fence claim, saying the clashes started after one of its patrols came under fire.
It was the first such fighting since Pakistan announced plans earlier this year to fence and mine sections of the border to restrict Taleban fighters.
The Afghan government says the plan will endanger civilian lives and separate Pashtun tribes and families.
The Afghan defence ministry said in a statement that the fighting took place between the Afghan border town of Shkin and Angoor Adda in Pakistan's tribal areas.
The Afghan government has been strongly opposed to Pakistani plans to build the fence, because it argues that such a move would make the disputed border between the two countries become a permanent boundary.
"Today at 9:30 am (0500 GMT) the Afghan army moved to the area and removed the fence," the defence ministry statement said.
"Pakistani troops fired on our forces, and the Afghan army returned fire."
It said that Afghan forces arrived in the area on Tuesday, after which Pakistani troops immediately stopped work on the barbed wire fence and pulled back.
"But unfortunately, taking advantage of the darkness of the night, the Pakistani forces again erected fences overnight Wednesday," the statement said.
But the Pakistani military spokesman, Gen Waheed Arshad, told the BBC that the clashes were unconnected with the fence, which in any case was deep inside Pakistani territory.
Gen Arshad said the fighting began after a Pakistani border patrol came under an unprovoked attack by Afghan forces.
There have been no injuries in the fighting reported by either side.
Islamabad says it has no choice but to fence sections of the mountainous 2,640km-long border if it is to comply with repeated calls by the international community to stop Taleban insurgents based in Pakistan from mounting attacks inside Afghanistan.
Pakistan says the fence is necessary to stop Taleban militants
The Afghan government says it has begun diplomatic efforts to stop Pakistan from fencing the border.
It has also written to the head of the United Nations, Ban Ki-moon, to express "deep concern".
Afghanistan argues that the border between the two countries - known as the Durand Line - is disputed because it cuts off part of its territory.
The Durand Line was drawn up in 1893 by British India, which once included Pakistan, to divide powerful Pashtun tribes.
The BBC's M Ilyas Khan in Karachi says few expect Pakistan's fence plan to stop Taleban movement.
But the measures might help ease pressure on Pakistan from the US, Nato and the UN who want it to do more to curb militant attacks in Afghanistan, he says.