ISLAMABAD/TORKHAM, Afghanistan (Reuters) - Pakistan Prime Minister Nawaz Sharif ordered the two main border crossings to Afghanistan to be re-opened on Monday, after their closure last month following a series of attacks that Islamabad blamed on militants operating from across the frontier.

Pakistani Prime Minister Nawaz Sharif attends a ceremony to inaugurate the M9 motorway between Karachi and Hyderabad, near Hyderabad Pakistan February 3, 2017. REUTERS/Caren Firouz

Relations between the countries have been tense in recent months, with both accusing each other of not doing enough to tackle militants.

Pakistan last month shut the crossing at Torkham, on the road from the northwest city Peshawar to the Afghan city of Jalalabad, and at Chaman, on the road between the southwestern city of Quetta and Kandahar in Afghanistan.

The decision hit cross-border trade heavily, stranding thousands of vehicles on both sides of the border.

“So many trucks loaded with vegetables were sent back to Jalalabad,” said Ahmad Jan, a driver who said he had been waiting on the Afghan side of the border for more than three weeks with a truckload of coal.

“I have been sleeping in my truck for the whole time because the owner wanted us to stay,” he said.

Haji Aslam, head of the Transit Union, representing drivers on both sides of the border, said some 4,000 trucks had been held up on the Afghan side of the border and 6,000 on the Pakistan side, where tonnes of fresh produce meant for export has gone rotten and been thrown away.

Pakistan acted after more than 130 people were killed in a spate of attacks by Pakistani militants that Islamabad says have taken shelter in Afghanistan. Afghanistan denies harboring them.

Afghanistan has long accused Pakistan of turning a blind eye to Afghan Taliban commanders on its soil and even of supporting the militant group, something Islamabad denies.

“Pakistani Prime Minister Nawaz Sharif has issued orders to immediately open the Pakistan-Afghanistan border,” Sharif’s office said in a statement.

Sharif said this was being done despite recent attacks in Pakistan being traced back to militants using Afghan sanctuaries.

“We hope that the Afghanistan government will take all necessary actions to eliminate the reasons for which this step (border closure) was taken.”

Pakistani security sources said several Pakistani Taliban commanders were killed in a U.S. drone strike last week inside Afghanistan, though neither country has confirmed the attack.

Attahullah Khogyani, a spokesman for the governor of the Afghan province of Nangarhar, said border talks were ongoing but the gates at Torkham had not been opened.

Closing the border crossings chokes off key trading routes for landlocked Afghanistan, although it also has trade ties with other neighbors, such as Iran.

Last year, Pakistan started building a barrier at Torkham, angering Afghanistan which rejects the colonial-era Durand Line border drawn up in 1893 and does not want a solid recognition of the boundary.