Musharraf’s position has been in doubt since elections in February. The resignation means that the West has lost its most important ally.