A truck enters Pakistan from Afghanistan at the border crossing in Torkham on June 18, 2016. (AFP)

Pakistan and Afghanistan have agreed to reopen a key border crossing that was closed for almost two weeks.

Pakistan’s paramilitary Frontier Corps said in a statement on Wednesday that the decision came during successful talks between representatives of the two sides in Chaman, a border town in Pakistan’s southwestern province of Balochistan.

The Frontier Corps confirmed that Chaman border crossing would reopen on Thursday.

The crossing was shut by Pakistani authorities after Afghan nationals burnt the Pakistani flag and pelted stones at security personnel from across the border.

Chaman is one of the two border crossings between the neighbors and thousands of people use it daily to visit relatives on the other side.

In addition to that, trade between the two countries has been badly hit due to the closure of the border in the restive province.

In June, Torkham border crossing, which is one of the major international border crossings between Pakistan and Afghanistan, was closed after deadly clashes between the armed forces of both countries. It was later reopened after negotiations.

Afghan families walk to enter Pakistan from Afghanistan at the border crossing in Torkham, June 18, 2016. (AFP)

The closure had kept thousands behind the crossing point, which connects Afghanistan’s eastern province of Nangarhar to Pakistan’s northwestern tribal district of Khyber.

Two Afghan border guards and one Pakistani army officer were killed in the deadly clashes, with each side blaming the other for starting fire.

Clashes erupted along the border after Pakistan started building a barrier at the crossing in a bid to stop the movement of Afghan militants into the Pakistani territory.

Relations between Afghanistan and Pakistan have been tense in recent years over the ongoing militancy. Senior Afghan officials frequently blame elements inside the Pakistani spy agency, Inter-Services Intelligence (ISI), for supporting the Taliban militants, while Islamabad blames the Afghan government for giving shelter to the militants on its side of the border.