He was a member of the Indian Parliament for over five decades, having been elected ten times to the Lok Sabha, the lower house, and twice to the Rajya Sabha, the upper house. He served as the Member of Parliament for Lucknow, retiring from active politics in 2009 due to health concerns. He was among the founding members of the Bharatiya Jana Sangh (BJS), of which he was president from 1968 to 1972. The BJS merged with several other parties to form the Janata Party, which won the 1977 general election. In March 1977, Vajpayee became the Minister of External Affairs in the cabinet of Prime Minister Morarji Desai. He resigned in 1979, and the Janata alliance collapsed soon after. Former members of the BJS formed the BJP in 1980, with Vajpayee its first president.