Paksas's political career began in 1997. He was elected to the Vilnius City Council in 1997, and in 1999 became mayor of Vilnius. He served as prime minister in 1999 for five months, resigning in opposition to the sale of the state-owned oil company, Mazheikiu Nafta, to a U.S. corporation. After his resignation, he worked as an advisor to the president. In 2000, he became mayor of Vilnius once again, after which he was elected to Parliament. From November 2000 until June 2001, he again was named prime minister, becoming the leader of the opposition. In March 2002, he became chairman of the newly-founded Liberal Democratic Party. After two rounds of voting, he was elected president of Lithuania on 5 January 2003, defeating incumbent Valdas Adamkus by winning 54.9% of the vote to Adamkus's 45.1%. Upon taking office on 26 February, he resigned his post as chairman of the Liberal Democrats, as required by the Constitution.