Pakistan's Prime Minister Nawaz Sharif has ordered the immediate reopening of border crossings with Afghanistan, more than a month after they were closed.

Pakistan sealed the Torkham and Chaman crossings on February 16, after a string of suicide attacks killed more than 130 people across the country, blaming the violence on Tehreek-e-Taliban Pakistan and other armed groups.

The closure left hundreds of thousands of people and lorries carrying food and other goods to Afghanistan stranded at the two major crossings of Torkham and Chaman.

"We have taken this decision on humanitarian grounds," a statement from Sharif's office said on Monday.

The statement said that, while the government had evidence that "anti-Pakistan elements" were present on Afghan soil, keeping the border closed was against the interests of ordinary people.

"We hope that the Afghan government will take all necessary steps to prevent the reasons why we undertook these steps [of closing the border] from recurring," it said.

Pakistan had temporarily reopened the border crossings for two days in early March to allow visitors with valid visas on both sides to return home.

Afghanistan has long blamed Pakistan for giving sanctuary to the Afghan Taliban and Haqqani Network leaders on its soil. Pakistan, though, accuses its northwestern neighbour of allowing Pakistani Taliban elements to operate in Nangarhar and other provinces.

Pakistan's Minister of Defence Khawaja Asif said the border was being used "as a thoroughfare" by Pakistani Taliban fighters.

But Afghan ambassador to Pakistan, Omar Zakhilwal, argued that closing it served no purpose "except to harm ordinary people and traders on both sides".

The Torkham and Chaman crossings are major arteries for $1.5bn in trade and commerce between the two neighbours. The Torkham crossing alone is used by about 15,000 Afghans every day.