Gen. Abdul Razeq, one of Afghanistan's most powerful security commanders, was killed on Thursday in a shooting attack by a bodyguard that dealt a severe blow to the Afghan government ahead of parliamentary elections on Saturday, officials said.