Since early 1988, Kocharyan has been one of the top leaders of the Karabakh Committee, dedicated to freeing NK from Azerbaijan domination. Kocharyan was elected to represent Nagorno-Karabakh in the Supreme Council (legislature) of Armenia, serving from 1989 until 1994, and was named to its presidium. In 1991 he was elected to the Supreme Council of NK. When the Azerbaijani armed forces mounted an offensive in August 1992, Kocharyan was named the chair of the NK Defense Committee and as well as its prime minister. He organized a successful counteroffensive that led to NK control over its territory and surrounding areas. In December 1994, Kocharyan was elected by the NK Supreme Council to the newly created post of president of NK. He was reelected in November 1996.
Armenian president Levon Ter-Petrosyan appointed Kocharyan to the post of prime minister in 1997. Many observers believed that the appointment of this highly popular war hero was an attempt to garner greater public support for Ter-Petrosyan's regime. As prime minister, Kocharyan worked on rebuilding areas still suffering from the 1988 earthquake, on reducing tax evasion, and stamping out corruption in the police and military forces. He revamped the cabinet and established ties with myriad political parties, which benefitted him when he later ran for the presidency of Armenia.
Ter-Petrosyan announced in September 1997 that he had accepted a peace plan proposed by the Organization for Security and Cooperation in Europe (OSCE) as a basis for resolving the NK conflict that would require "compromises" from Armenia. The two-stage plan called for NK Armenians to withdraw from most territories outside of NK and for international peacekeepers to be deployed, followed by discussion of NK's status. The announcement caused open criticism by Kocharyan. Yerkrapah, a legislative faction and militia group composed of veterans of the NK conflict, called for the resignation of Ter-Petrosyan. Many members of Ter-Petrosyan's legislative faction defected and heated debate in the legislature culminated in his resignation on 3 February 1998. The duties of acting president then devolved to Kocharyan.
An extraordinary presidential election was declared for 16 March 1998. The main contenders were Kocharyan, Vazgen Manukyan (who had run against Ter-Petrosyan in 1996 and was head of the National Democratic Union), and Karen Demirchyan (head of the Armenian Communist Party from 1974 until 1988). The top two vote-getters in the first round were Kocharyan and Demirchyan. No candidate achieved the required majority vote (over 50%), so a runoff election was scheduled for 30 March 1998. Many voters were attracted to Demirchyan because of nostalgia for the relative economic security of his Soviet-era rule over Armenia, and because Kocharyan at times appeared too low-key and soft spoken as a campaigner. Improving his appeal to the voters and benefitting from added endorsements from political groups such as the Armenian Revolutionary Federation (ARF), Kocharyan won the runoff election. He was inaugurated on 9 April 1998 as Armenia's second president since independence. He was reelected on March 5, 2003, for a second five-year term.