Shortly after the attack , Afghan officials suggested that the attempt to kill Mr. Karzai was the work of militants who had infiltrated Afghanistan 's security forces and had ties to groups linked to Al Qaeda in Pakistan 's tribal areas .