The independent-minded judge was fired in 2007 by then-President Pervez Musharraf , after pursuing a case challenging the president 's rule .