ISLAMABAD - Pakistan says a border dispute that triggered recent deadly clashes with Afghanistan is likely to be settled later this week, paving the way for Islamabad to fully reopen a busy crossing with the landlocked neighboring country.

The Pakistani military reiterated on Wednesday that clashes erupted after Afghan forces fired at government enumerators trying to conduct a census-related activity on the Pakistani side of two divided villages in the southwestern town of Chaman.

The skirmishes left casualties on both sides, and heavy gunfire continued for hours until the two sides agreed to conduct a joint geological survey of the border villages to "remove discrepancies."

"Now surveyor generals from the two sides have sat down together and examined the maps, and I think the dispute will be settled in a day or two and, accordingly, [next steps will be taken]. Obviously, we have no such desire to have access over Afghanistan's territory. So, hopefully this issue will be resolved," said Sartaj Aziz, Pakistan's foreign policy adviser.

Pakistan and Afghanistan Forces Clash at Chaman Bo FILE - Relatives move a boy who was injured during border clashes between Pakistan and Afghanistan forces on the border area, at a hospital in Chaman, Pakistan, May 5, 2017. FILE - Relatives move a boy who was injured during border clashes between Pakistan and Afghanistan forces on the border area, at a hospital in Chaman, Pakistan, May 5, 2017.

Mutual 'misunderstandings'

Afghan authorities insist they opened fire to prevent Pakistani forces from "occupying our land" and had alerted the other side against conducting any activity in the disputed area.

Speaking to reporters in Islamabad on Wednesday, Aziz maintained that the border line passes through the two villages and it was difficult to determine its exact location, which created mutual "misunderstandings" and prompted last week's "unfortunate" clashes.

Pakistan also swiftly closed the Chaman border crossing, stranding thousands of travelers as well as trade and transit convoys headed to landlocked Afghanistan.

However, Aziz said Pakistani authorities have made an exception for ailing Afghans and those visiting the country on valid visas, allowing them to leave and return home through the Chaman crossing. He went on to say Islamabad will consider reopening the crossing for all traffic once differences over the two border villages are resolved.

Counterterrorism efforts

Earlier, Aziz told a conference of Pakistani and Afghan officials, as well as regional experts, that Pakistani forces have "successfully eliminated" terrorism infrastructure in traditionally militant-dominated tribal areas near the border with Afghanistan.

He said Pakistan's counterterrorism operations and border security measures along a nearly 2,600-kilometer frontier between the two countries are part of efforts Islamabad is making to help stabilize Afghanistan.

"We have to extend our security presence right up to the border, otherwise if we create a security vacuum it will again be filled by undesirable elements," Aziz warned.

"So, we hope that in due course when peace returns to Afghanistan, the option of a soft border or no border can be implemented once again. But right now, we cannot afford our tribal areas again to be infested by undesirable elements," he noted.

WATCH: Pakistan Official Addresses Taliban, Violence, Peace

Aziz reiterated that a negotiated settlement between the Afghan government and Taliban can only bring peace to the war-ravaged nation.

"Toward this end, Pakistan has been making sincere efforts for facilitating talks between the Afghan government and the Taliban. Our consistent message to the Taliban has been that they must give up violence and join the peace process," he explained.

Afghanistan and Pakistan accuse each other of harboring militants involved in terrorist attacks in both countries. Aziz insisted that once in place, Islamabad's border security plans will address mutual concerns and ease tensions in bilateral ties.

Afghan officials oppose Pakistani border security plans because Kabul has traditionally disputed portions of the frontier that were demarcated by former British rulers of the Indian subcontinent.

Islamabad dismisses those objections and maintains it inherited the international border when Pakistan gained independence from Britain in 1947.