Violence has spread in recent months in areas of Pakistan near the border with Afghanistan , which are believed to be sanctuaries for al Qaeda and Taliban militants .