Pakistan says it has reopened the main border crossing with Afghanistan after it was briefly shut down following mortar fire from across the border.

On Wednesday, Pakistan said it closed the Torkham border crossing "in order to ensure safety and security of vehicles and pedestrians".

More:

The Torkham border crossing, at the top of the Khyber Pass, through which thousands of vehicles pass every week, is the main trade link between the uneasy neighbours.

"The Pakistan side immediately contacted Afghan authorities and conveyed serious concerns over the incident, which could have caused casualties. The routine border terminal operations resumed in the afternoon," the Pakistan government said in a statement late on Wednesday.

In September last year, Pakistan opened the crossing for 24 hours a day to boost trade.

"Some mortars were fired from across the border in Afghanistan and landed inside Pakistan. They caused some damage to vehicles," Mahmood Aslam Wazir, deputy district commissioner of the area on the Pakistani side, told Reuters news agency.

Pakistan and Afghanistan are both allies of the United States but their relations have rarely been close.

A Pakistani soldier at the border post in Torkham [File: Salahuddin/Reuters]

Afghanistan has for years accused Pakistan of supporting the Taliban armed group. Pakistan denies doing so and in turn accuses Afghanistan of supporting armed groups fighting the Pakistani government.

Exchanges of fire across a border Afghanistan has never recognised are common.

An Afghan official denied that Afghan forces had fired into Pakistan.

Attaullah Khogyani, spokesman for the governor of Nangarhar province, on the Afghan side of the border, suggested that Pakistani forces had fired the mortar bombs as a ruse.

"In the past, Pakistan has played the same game whenever they want to close the Torkham crossing," Khogyani told Reuters.

Pakistan was angered earlier this week when Afghan President Ashraf Ghani condemned the arrest of a Pakistani ethnic Pashtun rights activist.

Pashtuns live on both sides of the border.

Pashtuns in Pakistan have been protesting recently against their government in a campaign for greater rights that many Pashtuns in Afghanistan support.

It was not clear how long the border would remain closed.