By Hamid Shalizi and Mirwais Harooni
KABUL (Reuters) - Afghanistan warned Pakistan on Monday that it will bear the consequences of more clashes on their contested border, hours after a new bout of fighting erupted between the neighbors.
The clash is the latest indication of a sharp deterioration in relations between the important U.S. allies, and comes days before a Pakistani general election.
In the case of "any further unprovoked attacks by Pakistani forces, Pakistan will bear responsibility for any consequences," the Afghan Foreign Ministry said in the strongest words yet on the conflict.
It is unclear if there were any casualties in the Monday clash, which sparked a large protest in the Afghan capital, Kabul, drawing thousands of men chanting "Death to Pakistan".
Pakistan is seen as vital in bringing stability to Afghanistan as most Western forces prepare to withdraw by the end of next year.
The United States and other powers involved in Afghanistan have been trying to promote cooperation between the Asian neighbors, who have a history of mistrust.
Afghan officials said the clash on Monday erupted after Pakistani troops tried to repair a gate on the border, in the Afghan district of Goshta in Nangarhar province, where last week an Afghan border policeman was killed in an exchange of fire.
"This morning's clash began after the Pakistani side continued to repair the gate, which was damaged in the previous fighting," said Ahmad Zia Abdulzai, a spokesman for the Nangarhar governor.
It was not clear which side fired first.
A Pakistani official, speaking on condition of anonymity, said Afghan soldiers initiated the clash. Afghan Interior Ministry spokesman Sediq Sediqqi blamed Pakistan.
"The construction of outposts or a gate on Afghan soil is illegal and we will do whatever we can to stop it," Sediqqi said.
Afghanistan says the gate, adjacent to Pakistan's Gursal military post, encroaches on its territory.
In Kabul, about 3,000 men gathered in support of the Afghan security forces, hoisting Afghan flags and banners depicting a photograph of the border policeman killed last week.
"Pakistan's invasion is a big chance for the Afghan people to become a united nation," member of parliament Baktash Seyawash told the crowd to cheers and shouts of "Death to the ISI".
The Inter-Services Intelligence (ISI) agency is Pakistan's main security agency.
"We have only one enemy and that is Pakistan," Seyawash said.
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, which was drawn by Britain in 1893 through lands populated by ethnic Pashtun tribes.
Pakistan helped the Taliban take power in Afghanistan in the 1990s but says it cut support to them after joining the U.S.-led campaign against militancy following the September 11, 2001, attacks on the United States.
Pakistan, which is facing its own Taliban insurgency and holds a general election on Saturday, says it wants peace and stability in its western neighbor.
Afghan President Hamid Karzai has ordered officials to take "immediate action" to remove the gate and other Pakistani military installations near the Durand Line, as the border is known, after the British colonial official who drew it.
Afghanistan maintains that activity by either side along the Durand Line must be approved by both countries.
(Additional reporting by Rafiq Sherzad in JALALABAD, Writing by Dylan Welch and Amie Ferris-Rotman; Editing by Robert Birsel)