Born and raised in Ashigram, a remote village in Dadeldhura, Deuba completed his primary education there and secondary education in Doti. He completed his higher education from Tri-Chandra College, and registered as a research fellow at the London School of Economics. In 1991, he was elected to the House of Representatives and served as the Minister of Home Affairs in the cabinet led by Girija Prasad Koirala. Deuba rose to become prime minister after Manmohan Adhikari tried to dissolve the parliament for a second time in two years in 1995. He oversaw the signature of the Mahakali treaty with India during his first term. His second premiership started in July 2001 amidst the rise of the Maoists and he later declared a state of emergency and listed the Communist Party of Nepal (Maoist) as a "terrorist organisation". He was dismissed by King Gyanendra for being incompetent in October 2002, but was reappointed prime minister in June 2004. He was arrested under corruption charges following the 2005 coup d'état by the king, but was released in February 2006.