The military leader believed he could save Pakistan from a self-serving political establishment, but resigned in disgrace