Modi, 68, has carefully constructed an image of himself as a pious man of the people, a would-be monk called to politics who has elevated India's status globally and transformed its general elections from a contest of political parties on social and economic issues into a cult of personality. By Friday morning, the vote count showed his Bharatiya Janata Party winning a majority of seats in India's lower house of Parliament, and able to form a government without a coalition.
"He's able to build the narrative the way that he really wants people to believe. He's actually in many ways a pied piper, that whatever he says, people actually believe it," said Modi biographer Nilanjan Mukhopadhyay.
The cult has been fueled by a social media blitzkrieg. There was NaMo TV and a NaMo app. Like President Donald Trump, to whom he is often compared, Modi is a big fan of Twitter, using it and a YouTube channel managed by the BJP to bypass traditional media.
The party has become synonymous with Modi, whose near-ubiquitous bearded and bespectacled visage appears on BJP billboards blanketing India's vast territory. "Every vote for the lotus" — the BJP's ballot symbol — "will go into Modi's kitty," Modi said recently.
And when India retaliated after a suicide bombing in Kashmir with an airstrike of an alleged militant training camp inside Pakistan, Modi took on an even larger persona: He started referring to himself as India's "chowkidar," or watchman, adding it as a prefix to his official Twitter account. Party leaders and a number of his 47.3 million Twitter followers quickly followed suit.
"The BJP reelection campaign has been a presidential-style one — a relatively new phenomenon in Indian politics," said Nikhil Menon, a historian focused on South Asia at the University of Notre Dame in Indiana. "The strategy behind this is to use the enormous popularity of Narendra Modi to the advantage of the party."
At a recent BJP rally on a dusty parade ground in New Delhi, hundreds of supporters in T-shirts carrying the slogans "Modi once more" and "Modi again" chanted his name in Modi masks while lifting life-size cardboard cut-outs of the prime minister into the air.
"Please put your hands together and make it sound like an airstrike," a party worker implored the crowd. When Modi took the stage in his characteristic white kurta and flag-of-India sash, he started by mentioning that he'd met several people on Delhi's Metro.
"BJP has ended VIP culture," he declared. "Entire government is now connected with people via mobile phones." In his five years as premier, Modi has never taken reporters' questions at a news conference. Instead the government press information bureau gives media outlets unlimited access to in-house photos and footage.
Populism and nationalism are not new to India, whose modern history was dominated by the political dynasty of the Indian National Congress party, which led the country to independence from British rule in 1947.
The party of Mahatma Gandhi and Jawarlalal Nehru, India's first prime minister, has produced six of India's 14 prime ministers, including Nehru's daughter Indira Gandhi, herself a populist though of a different ideological stripe, and her son Rajiv Gandhi.
The BJP has produced only two. Rahul Gandhi, Nehru's great-grandson, took the Congress reins from his mother, Sonia Gandhi, after the party was decimated in the 2014 polls, winning only 44 of 543 seats.
Modi's unlikely rise to power has also endeared him to voters. He was the third of six children born to Damodardas Modi, who ran a small tea shop at the local railway station in the tiny town of Vadnagar, in the western state of Gujarat. The family struggled to make ends meet, which meant Modi had to help his father run the shop.
Modi's characterization of his opponents as out-of-touch post-colonial elites has resonated in a country where opportunity is often still constrained by caste. Modi began his political rise as a teenager in Gujarat, joining the militant Hindu organization Rashtriya Swayamsewak Sangh, which modeled itself in the 1930s after fascist Italy and which is regarded as the ideological parent of the BJP. Speaking at rallies, Modi built a reputation as a powerful orator and political strategist, and in the late 1980s was tapped as a general secretary of the BJP in Gujarat.
He rose quickly through the party's ranks and, by October 2001, was running the state as chief minister. In 2002, a group of Hindu pilgrims traveling by train were allegedly attacked by a Muslim mob. Hindus in Gujarat ransacked their Muslim neighbors' homes, setting people on fire and raping women. Modi's government was seen to have done little to stop the rioting that killed about 1,000 people.
Since Modi and the BJP took the helm of the Indian government, Hindu mobs have lynched dozens of people — mainly Muslims and lower-caste Dalits — suspected of illegally transporting or consuming beef. Many Indian states have laws limiting or banning the slaughter of cows, which are sacred to Hindus, and rather than condemn the killings, some BJP leaders have come to the alleged killers' defense, garlanding them with marigolds as protectors of the faith.
Though Modi himself hasn't publicly supported the vigilantes, he has been accused of failing to condemn them, thereby cultivating a climate of intolerance. His recent visit to the cave temple signals that religion, and its defense, will remain a political priority.
Associated Press journalist Rishabh R. Jain contributed to this report.