Mr. Musharraf declared a state of emergency last November and purged the Supreme Court , in order to halt any legal challenges to his presidency .