NEW DELHI — After two decades of aspiring to economic and strategic clout in the Western world, India is now paying attention to those closer to home.

India's newly elected Prime Minister Narendra Modi wants to focus on India's immediate neighborhood. His trip to Nepal this week, the first by an Indian prime minister in 17 years, is an unambiguous shift in New Delhi's diplomatic priorities, long obsessed with wooing the West.

The first sign came when Modi pulled a diplomatic coup of sorts by inviting leaders of South Asian nations to his swearing-in ceremony after his resounding election victory in May.

His first foreign trip was to Bhutan. His foreign minister Sushma Swaraj's first visit was to Bangladesh.

In Nepal, Modi pledged not to meddle in Nepal's internal affairs, announced $1 billion in credit assistance and performed an elaborate prayer ritual in the 5th century Hindu temple. In return, Modi said, Nepal can help end India's darkness.

"Nepal can free India of its darkness with its electricity," said Modi referring to Nepal's hydro-power potential. "But we don't want free electricity, we want to buy it. Just by selling electricity to India, Nepal can find a place in the developed countries of the world."

The metaphoric elephant in the room that no one spoke about was China and its deepening investment and ties in Nepal during the years that India looked elsewhere.

"Modi pulls out all the stops for Nepal trip: Is this enough to counter China?" asked news portal Firstpost.

Analysts say Modi's hardnosed economic pragmatism is behind India's zooming-in on the immediate neighborhood. The right-of-center news Web site Niti Central said Modi wants to turn India's "hostile borders benign and ultimately gateways for free trade and commerce." Modi told lawmakers in Kathmandu that "borders must be bridges not barriers."

"Modi mantra warms Nepal's hearts," said the Kathmandu Post newspaper. Nepali social media was abuzz.

In contrast, the centerpiece of the 10-year rule of former prime minister Manmohan Singh was the landmark civil nuclear agreement with the United States and the strategic alignment between the two democracies. Singh also worked hard to repair relations with nuclear-armed neighbor Pakistan but failed to leave behind much of a peace legacy.

India's "special emphasis" on its neighborhood, said foreign minister Swaraj last month, should not be misunderstood.

"India is not the big brother, it is just an elder brother," Swaraj said in Nepal. Swaraj is scheduled to travel to Myanmar next week.

Modi also punned on old fears of India's regional dominance.

"I thought I should hit Nepal. Then I thought you would feel bad," Modi said in Nepal's Constituent Assembly, and paused for effect. "But when I talk of hitting Nepal, I mean H-I-T. Highways, Infoways and Transways. You too would want this kind of a hit quickly," he said with a laugh.