During the late 18th-early 19th centuries, the principality of Gorkha united many of the other principalities and states of the sub-Himalayan region into a Nepali Kingdom. Nepal retained its independence following the Anglo-Nepalese War of 1814-16 and the subsequent peace treaty laid the foundations for two centuries of amicable relations between Britain and Nepal. (The Brigade of Gurkhas continues to serve in the British Army to the present day.) In 1951, the Nepali monarch ended the century-old system of rule by hereditary premiers and instituted a cabinet system that brought political parties into the government. That arrangement lasted until 1960, when political parties were again banned, but was reinstated in 1990 with the establishment of a multiparty democracy within the framework of a constitutional monarchy.
An insurgency led by Maoists broke out in 1996. During the ensuing 10-year civil war between Maoist and government forces, the monarchy dissolved the cabinet and parliament and re-assumed absolute power in 2002, after the crown prince massacred the royal family in 2001. A peace accord in 2006 led to the promulgation of an interim constitution in 2007. Following a nationwide Constituent Assembly (CA) election in 2008, the newly formed CA declared Nepal a federal democratic republic, abolished the monarchy, and elected the country's first president. After the CA failed to draft a constitution by a 2012 deadline set by the Supreme Court, then-Prime Minister Baburam BHATTARAI dissolved the CA. Months of negotiations ensued until 2013 when the major political parties agreed to create an interim government headed by then-Chief Justice Khil Raj REGMI with a mandate to hold elections for a new CA. Elections were held in 2013, in which the Nepali Congress (NC) won the largest share of seats in the CA and in 2014 formed a coalition government with the second-place Communist Party of Nepal-Unified Marxist-Leninist (UML) with NC President Sushil KOIRALA serving as prime minister. Nepal's new constitution came into effect in 2015, at which point the CA became the Parliament. Khagda Prasad Sharma OLI served as the first post-constitution prime minister from 2015 to 2016. OLI resigned ahead of a no-confidence motion against him, and Parliament elected Communist Party of Nepal-Maoist (CPN-M) leader Pushpa Kamal DAHAL (aka "Prachanda") prime minister. The constitution provided for a transitional period during which three sets of elections – local, provincial, and national – needed to take place. The first local elections in 20 years occurred in three phases between May and September 2017, and state and federal elections proceeded in two phases in November and December 2017. The parties headed by OLI and DAHAL ran in coalition and swept the parliamentary elections, and OLI, who led the larger of the two parties, was sworn in as prime minister in February 2018. In May 2018, OLI and DAHAL announced the merger of their parties - the UML and CPN-M - to establish the Nepal Communist Party (NCP), which is now the ruling party in Parliament.