Following the resignation of Girija Prasad Koirala as prime minister, Deuba defeated Sushil Koirala to become the parliamentary party leader of the Nepali Congress and was appointed Prime Minister for a second time on 26 July 2001. He became prime minister shortly after the royal massacre and during the heights of the Maoist insurgency, and he soon announced a ceasefire with the Communist Party of Nepal (Maoist). In August 2001, he began peace talks with the Maoists, but after the Maoists pulled out of talks and attacked the army in November 2001, Deuba declared a state of emergency, and the Communist Party of Nepal (Maoist) was listed as a "terrorist organisation".