President Pervez Musharraf announced his resignation Monday, ending a nearly nine-year tenure that opponents said was hampering Pakistan’s shaky return to democracy.

Musharraf said he wanted to spare Pakistan from a dangerous power struggle with opponents vowing to impeach him. He said he was satisfied that all he had done “was for the people and for the country.