Indian Prime Minister Narendra Modi and Facebook CEO Mark Zuckerberg after a meeting on Sept. 27. (David Paul Morris/Bloomberg)

Indian Prime Minister Narendra Modi had already dined with Silicon Valley’s tech titans and toured Tesla Motors, and now Sunday he was sitting down for a talk with Facebook founder Mark Zuckerberg. Soon, he’d set off for the 15-minute drive to Google to talk with its chief executive. Then he had a reception at a sold-out, 18,000-seat arena in San Jose.

India offers a tantalizing opportunity for tech firms such as Apple, Google and Facebook. India has 1.25 billion residents but lags far behind the United States in the digital infrastructure needed to spur its online economy. Still, the number of Internet users in India is surging, estimated to reach 328 million this year alone.

At Facebook, Modi acknowledged the challenges faced in wiring his massive country, noting that investors worldwide looking for places to invest their money should consider India.

“So I’m giving them the advice — here’s the place,” Modi said through an interpreter.

Modi’s trip to Silicon Valley — the first to California by any Indian leader in more than 30 years — signals the rising influence and economic power wielded by this technology hotbed. Other world leaders recognize it, too, explaining why a wave of foreign dignitaries have added Silicon Valley stops to their traditional U.S. tours in recent years. Heads of state from Japan and Brazil visited earlier this year, following earlier trips by the leaders of Ireland, Israel, Russia and Malaysia. The region is so popular that last year the nonprofit Silicon Valley Office of Protocol opened its doors to help with the finer points of international diplomacy, including etiquette and manners.

Modi’s trip is the first to California by any Indian leader in more than 30 years. (Marcio Jose Sanchez/AP)

“Silicon Valley is, in some ways, more important than New York and the financial sector, or D.C. and the political world,” said Venky Ganesan, managing director at Menlo Ventures. World leaders “see clearly that when it comes to just about any sector, Silicon Valley is eating them up.”

It’s not just world leaders who are interested in Silicon Valley. In March, ambassadors from 35 countries — including Kazakhstan, Gabon and Paraguay — toured the region to soak up lessons on how technology might contribute to their home economies.

Modi’s visit was partly a recognition of the tremendous Indian influence at tech firms. Nearly 16 percent of tech startups have Indian founders, according to researchers. Indians and Indian Americans make up an outsize proportion of the tech workforce. At Google, Asians, who include Indians, account for 30 percent of employees. During his stops in Silicon Valley, it often seemed as if Modi was playing to a hometown crowd — no translation required.

Modi is also at home with technology. With 15 million Twitter followers and 30 million Facebook fans, he trails only President Obama among world leaders in social media popularity. He noted during his talk with Zuckerberg how social media has changed the way he governs. The instant feedback made possible by tweets and posts helps steer his government's decisions.

“Instead of elections every five years, you have elections every five minutes,” Modi said.

Foreign leaders hope to learn from Silicon Valley firms and instill the region’s entrepreneurial spirit back home.

“They see Silicon Valley as a center of innovation and are trying to understand it and what it would take to re-create that in their country,” said William F. Miller, professor emeritus of computer science at Stanford University, who has accompanied many foreign delegation visits over the years.

But it remains unclear if these visits by heads of states result in actual business deals or propel countries down a more entrepreneurial path. Their significance may be more symbolic than practical.

In April, when Japanese Prime Minister Shinzo Abe visited the tech firms, he gave a speech at nearby Stanford to urge his nation to adopt the dynamism of Silicon Valley. Abe also announced a small program that would send 30 Japanese entrepreneurs to pitch their ideas to Silicon Valley investors.

Two months later, Brazil’s president, Dilma Rousseff, was here at the end of a five-day U.S. tour that included stops in the traditional power towns of Washington and New York. She, too, met with technology leaders. And she took a ride in one of Google’s self-driving cars. During Rouseff’s visit, Google announced that it would more than double the number of its engineers working in Brazil — a deal that wouldn’t change Brazil's economy but could pay dividends at some point.

During Modi’s stop at Google, Indian-born chief executive Sundar Pichai announced that his company would install free WiFi at 100 of India’s largest railway stations. Plans call for wiring 400 stations by year’s end. Pichai said it was a contribution toward Modi’s “Digital India” initiative, an $18 billion government plan to string high-speed Internet access across the subcontinent.

But, of course, they have a long way to go, given India’s scale: The country has about 7,500 railway stations.

Chinese President Xi Jinping didn’t stop in Silicon Valley on his U.S. tour last week, but in Seattle he met with U.S. tech leaders, including Apple’s Tim Cook, Facebook’s Zuckerberg and’s Jeffrey P. Bezos, whose company is based in Seattle. (Bezos also owns The Washington Post.)

Silicon Valley’s appeal to foreign leaders is driven by the same impulses that send tourists to take selfies outside the corporate headquarters of Facebook or Apple.

“This is where the magic is happening,” said Bipul Sinha, a longtime tech investor and chief executive at data management startup Rubrik.

That was not lost on Poorva Agrawal, an Indian worker at Facebook who stood in the audience during Modi and Zuckerberg's discussion.

“It’s great to see him here,” she said. “It’s important. Maybe something will come of this to help the country back home.”