Last month , the Supreme Court ruled that Mr. Musharraf violated the constitution when he imposed emergency rule and dismissed top judges in an effort to hold onto the presidency .