Atal Behari Vajpayee: A mercurial moderate
Son of a school teacher from Gwalior in central India, Atal Behari Vajpayee came into political prominence because of his renowned oratory.
His political roots lay with the right-wing Rashtriya Swayamsevak Sangh (RSS), the Hindu nationalist organisation from which India's governing Bharatiya Janata Party (BJP) draws its ideological roots.
In the 1950s, the RSS decided to send Vajpayee to parliament to take on Jawaharlal Nehru's ruling Congress government. He won a seat in 1957.
This brought the 33-year-old Vajpayee to Delhi, changed his outlook about life and made him a moderate.
But he remained an acerbic opponent of the government, as the RSS wanted him to be.
In parliament, he once said that Nehru had "inverted vision" because of too much standing on his head during yoga practice.
Politics in India changed dramatically in the 1970s.
India's then prime minister Indira Gandhi led India in a war against neighbouring Pakistan in 1971, which resulted in the creation of Bangladesh, formerly East Pakistan. Vajpayee famously compared her to the Hindu goddess Durga in parliament. Goddess Durga is depicted as a warrior who defeats evil in Hindu mythology.
Four years later in 1975, Gandhi declared a state of emergency across India. The period was marked by massive media censorship, restrictions on civil rights and a forced mass sterilisation campaign.
Democracy was suspended and all opposition leaders, including Vajpayee, were sent to jail. In a questionable move, Vajpayee pleaded with Gandhi about his "bad health" and was moved from a prison in the southern city of Bangalore to a hospital in Delhi.
The emergency lasted until January 1977. Elections were held in March. Gandhi's Congress party suffered a shock defeat at the hands of the newly formed opposition coalition Janata Party, of which Vajpayee was a member.
He became India's foreign minister and made efforts to improve relations with the country's two neighbours, Pakistan and China.
He realised that to succeed in India, you need to take a middle path rather than venturing to the extremes.
When the Janata Party collapsed in 1980, Vajpayee proposed that some of its members, who belonged to a faction called the Jan Sangh, should recast themselves into a brand-new mainstream political party.
The RSS agreed to the proposal and thus Vajpayee formed the BJP.
Revival of fortunes
During this time, Indira Gandhi moved the Congress party to become more Hindu-leaning. The RSS reacted by pushing an affiliate, Vishwa Hindu Parishad (VHP), to propagate a more strident Hindu line, bypassing the Vajpayee-led BJP.
Following the assassination of Gandhi by her bodyguards in 1984, the Congress party won a landslide victory in the general election. The BJP was reduced to two seats in the parliament.
Vajpayee faded into oblivion and even contemplated quitting the BJP. He was no longer an important leader or even a parliamentarian.
But then there was an unexpected turnaround.
Right-wing Hindu mobs tore down the 16th-Century Babri mosque in India's holy city of Ayodhya in December 1992, claiming that it was built on the site of a temple destroyed by Muslim rulers. The riots that followed killed nearly 2,000 people.
More unrest followed, with explosions in Mumbai killing 257 people, allegedly an act to avenge the killing of Muslims in the riots.
The RSS realised that the BJP could win the next election with a moderate leader at the helm and chose Vajpayee, who was running the party.
He briefly served as prime minister twice, failing to secure a majority to continue, and in 1999 he finally secured a five-year term.
One of the first things he did was to create a fence of moderate leaders around him, who advised him and kept the hardliners at bay. He was adept at maintaining a broad-based range of political allies.
The fact that he was the head of a National Democratic Alliance (NDA) government - comprising many parties and not merely the BJP - helped Vajpayee. He was able to ward off pressures from the RSS even though they made several attempts to unseat him.
As prime minister, he won accolades for reducing the role of government in running businesses and building a national ring of highways. In 1999, his army defeated Pakistan in the 10-week war in Kargil in Indian-administered Kashmir.
But the 2002 riots in the western state of Gujarat came as a setback.
The riots began after 60 Hindu pilgrims died in a train fire blamed on Muslims. The violence left more than 1,000 people, mostly Muslims, dead, and was among India's worst outbreaks of unrest. Narendra Modi, then the chief minister of Gujarat and now India's prime minister, was accused of turning a blind eye when Hindu mobs went on a rampage of revenge.
Vajpayee lost face and tried to sack Mr Modi, but more hardline elements in the party prevented him from doing so.
Two years later, the BJP was voted out, and the Congress party returned to power. By then, Vajpayee had completed six straight years in office spread over two terms.
Kingshuk Nag is the author of Atal Bihari Vajpayee: A Man for All Seasons