A key ally of the ruling Maoist-led coalition quit the government in protest after prime minister Prachanda sacked the army chief who refused to step down.