The attacks have shattered hopes that Pakistan may have come through the militant violence that has scarred its recent history and increased pressure on Prime Minister Nawaz Sharif’s government to show it was improving security.