The people streaming into the holy town came on an intimate quest: to be among the first to seek the blessings of a beloved god they said was returning home after 500 years.
These Hindu devotees took leaves of absence from work. They ate with fellow pilgrims, slept in the cold and sipped tea at roadside joints as they waited to see the dazzling new temple devoted to the deity Ram. Early in the morning, as a soft devotional melody played from speakers strung to electric poles, they took purifying dips in a river.
But it was another, smaller group, camped on the riverbank in Ayodhya, that made sure the moment was as much about India’s powerful prime minister, Narendra Modi, as it was about Lord Ram.
As a show of laser lights and bone-jarring beats went on in the background, about a dozen national television channels tried to outdo each other in what for most has become a guiding mission: to shine a favorable spotlight on the prime minister’s every move.
“We should not forget that this is because of Narendra Modi,” a commenter on one of the shows reminded his viewers.
Through a mix of incentives and coercion, the broadcast media has been enlisted in an image-building machine that glorifies Mr. Modi as an infallible, godlike leader. Through this prism, he is the author of every national success, an inescapable figure for ordinary people like the Ayodhya pilgrims, his continued rule seemingly inevitable.
At the same time, news of setbacks — Chinese encroachment on Indian border territory, deadly ethnic conflict in a northeastern region, unequal economic growth that is not producing enough jobs — is rarely discussed on TV, and even more rarely attributed to Mr. Modi. Posing questions to a prime minister is a thing of the past; Mr. Modi has not held a proper news conference in the decade since he took charge.
The inauguration of the Ram temple last month was rushed to coincide with the launch of the prime minister’s campaign for a third term in office. On display for the millions tuning in during his address was the full range of his skills as a communicator — his powerful oratory, his keen eye for symbolism and his savvy understanding of messaging in a new media age.
The temple’s construction, on land disputed between Hindus and Muslims, was the culmination of a four-decade movement by India’s Hindu right, the cornerstone of their effort to remake a secular republic into a Hindu majoritarian state.
The consecration ceremony was both religious ritual and viral spectacle, with Mr. Modi cast in the role of ultimate victor, striding alone in the frame. He said nothing of the bloody, divisive legacy associated with the dispute, in which a mosque that had stood for centuries was razed in 1992 by a Hindu mob that was driven by the belief that a temple had been there before.
Instead, in one stroke, he put himself at the center of a 500-year history and an even longer future.
“We have to lay the foundation of India for the next 1,000 years,” he said, after helicopters had showered flowers from above.
The guest list was heavy on Bollywood and entertainment royalty, businessmen generous with their purse, and gurus with a foot in each of those realms. The seating arrangement, one organizer jokingly said, was based on who had the most social media followers.
That tracked with how Mr. Modi’s tech-savvy party has harnessed celebrities and influencers in the service of his image.
In moments of political tension, stars with huge followings put out nearly copy-and-paste messages of support. And as the election nears, cabinet ministers have turned to podcasts and online broadcasts with influencers to reach a generation that gets its information outside the traditional channels that Mr. Modi has co-opted.
Front and center in the audience at the temple inauguration were stars like Amitabh Bachchan, one of India’s biggest cinema icons. With his phone out, he took photographs and videos of the moment for his combined following of over 100 million people across social media accounts.
His face was everywhere: welcoming passengers at the newly erected airport, and smiling out from billboards selling everything from flour to a “7 star” property in Ayodhya, a “kingdom reborn.”
In the days leading up to the ceremony, the television channels shouted their excitement from the riverbank, the noise increasing as you went upstream.
There was the state television network, Doordarshan, and NDTV, once an independent broadcaster but now under the control of a billionaire ally of Mr. Modi’s, both tying the prime minister to the monumental occasion, at least implicitly.
On another station, Republic Bharat, an anchor dived into the crowd to get their views. “Modi-ji did his duty, he built the temple,” said one man, before declaring the next targets for the construction of temples, in a refrain of the Hindu right that has intensified in recent days.
By happenstance, the laser light show on the eve of the inauguration fired up the moment the channel went live. Urged on by the producers from a corner, people danced in their chairs, and after the show closed, they broke into an all-out rave.
“It was our luck today — I really enjoyed it,” said the show’s main producer, Pratap Singh.
It mattered little that not much could be heard over the din. “Who listens to the guests these days?” he said with a grin. “It’s about the show you put on — you could see everyone was dancing.”
Farther up, another channel, ABP, turned for the second straight night to a program that made its intentions abundantly clear: “Who Will Become Prime Minister?” read the poster for the show, decorated with red thrones.
Participants, including one who, with a slip of the tongue, said he was on “Who Wants to Be a Millionaire?” — the names sound very similar in Hindi — made clear that the answer to the election question was Mr. Modi.
Placed between Republic Bharat and ABP was a channel that often has a single objective: stoking the polarization under which Mr. Modi’s ruling party thrives.
Sudarshan News, which like the rest of India’s broadcast media receives ample government advertising money, is unabashed in its divisive agenda — and was unmoved by the government’s advisory to the media before the inauguration against publishing content that “disturbs communal harmony.”
Every time guests veered into theological tangents, Suresh Chavhanke, the channel’s chairman, interjected to steer the show back to its focus: the opposition Congress party, which had to pay for its absence from the consecration, and India’s Muslim minority.
“We can get religious knowledge from anyone,” he said in cutting off a seer. “Tell me what your message is to the enemies.”
When another seer struck a tone of reconciliation, saying that the temple dispute was now in the past and that Muslims and Hindus should work on “brotherhood,” Mr. Chavhanke interrupted him. He pivoted to something often instigated by the Hindu right: an economic boycott of Muslims.
“See, on Sudarshan, this ‘brotherhood’ doesn’t work,” he said. “This drug of ‘brotherhood’ has damaged the Hindus a lot.”
At the inauguration, Mr. Chavhanke and several other media barons were among the handpicked guests, seated close to the front.
In an interview, Mr. Chavhanke denied saying what reporters from The New York Times had heard him say during his show, including a question he posed to the Hindu audience about how many kept swords in their homes.
“You are telling lies,” he said, although videos of his broadcast remain on the channel’s platforms.
Asked whether his channel had flouted the government advisory on communal harmony, Mr. Chavhanke said it followed all directives.
“Until today,” he said, “we have faced no action on the violation of any guidelines.”