Indian Prime Minister Narendra Modi has hailed the political power of social media, as he visited the headquarters of Facebook in California.
"To leaders all over the world: you are not going to gain by running away from social media," he said in Hindi during a question-and-answer session.
Facebook boss Mark Zuckerberg moderated the hour-long event.
Later on Sunday, Mr Modi was welcomed by more than 20,000 people at a stadium in nearby San Jose.
The SAP Center event also drew protesters against Mr Modi's human rights records among other issues.
Speaking at Facebook's campus in Menlo Park, Mr Modi said: "The strength of social media today is that it can tell governments where they are wrong and can stop them from moving in the wrong direction."
"We used to have elections every five years and now we can have them every five minutes," he added.
Mr Modi, 65, regularly uses both Facebook and Twitter to communicate with millions of his followers.
Both Mr Zuckerberg and Mr Modi shared emotional moments during the discussion.
After Mr Zuckerberg pointed out his parents in the audience, Mr Modi welled with tears speaking about his own.
He recounted stories from his childhood in a poor family, selling tea at a railway station and doing hard chores to earn money.
"It is hard to imagine that a tea seller has actually become the leader of the world's biggest democracy," he said.
The Facebook founder also told of a time when the company was going through what he called a "rough patch". His late mentor, Apple boss Steve Jobs, advised him to travel to India.
"Seeing the people and how people connected, reinforced what we were doing and is something I've always remembered," he said.
At the scene: Dave Lee, North America Technology Reporter
Outside the stadium, the enthusiasm for Mr Modi was on full display - though not without the accompaniment of a strong protest against his government.
Those not on "Team Modi" are angry at what they see as ignorance towards Mr Modi's past. In particular, they say he did little to prevent the killing of Muslims in the Gujarat riots in 2002.
And when it comes to Digital India, Mr Modi's plans to get a billion more Indians on the internet, they say that's a front for mass surveillance.
Yet the support for Mr Modi in the US appeared genuine - and its his tech-savvy attitude to communicating that seems to impress people most. "We're very proud," said one supporter outside the stadium.
Mr Modi said he wanted to connect all India's villages to the internet - around a billion Indians currently lack internet access.
Facebook says its internet.org project, which offers free access to a bundle of mobile phone web apps, can help get the developing world online.
But it has drawn criticism in India, accused of favouring Facebook over local services. Mr Zuckerberg has promised to open the scheme to a wider range of apps.
Mr Modi's tour of Silicon Valley included meetings with top officials from Apple, Google and other companies.
US tech companies see India as a big commercial opportunity, but want the country to reduce red tape.
Mr Modi wants to bring the success his compatriots have enjoyed in Silicon Valley - where around one in four tech companies is founded or run by Indians and Indian Americans - back to India.
On Monday, Mr Modi will attend the UN General Assembly in New York and is expected to hold talks with US President Barack Obama.