The reason for the deal is simple: Tibet.

At a time when President Obama’s decision to meet with the Dalai Lama has infuriated China, Mr. Rawal’s meetings in Beijing could have greater practical effect on the lives of Tibetans. Prodded by China, Nepal is now moving to close the Himalayan passages through which Tibetans have long made secret trips in and out of China, often on pilgrimages to visit the Dalai Lama in his exile in India.

If it once regarded Nepal with intermittent interest, China is now exerting itself more broadly toward its small Himalayan neighbor, analysts say  partly because of its concern that Nepal could become a locus of Tibetan agitation, partly as another South Asian stage in its growing soft-power fencing match in the region with India.

“Nepal has become a very interesting space where the big players are playing at two levels,” said Ashok Gurung, director of the India China Institute at The New School. “One is their relationship with Nepal. And the second is the relationship between India and China.”

In the broadest sense, India and China share similar goals in Nepal. Each wants Nepal’s political situation to stabilize and is watching closely as the country’s Maoists negotiate with other political parties over a new constitution that would fundamentally reshape the government. Each is also worried about security, as India is concerned about political agitation on the Nepalese side of their shared border, as well as the possibility that terrorists trained in Pakistan could transit through Nepal.

But India is also paying close attention to what many India experts consider newfound Chinese activism in South Asia, whether by building ports in Sri Lanka and Pakistan, or signing new agreements with even the tiniest South Asian nations like the Maldives. An expanding Chinese presence in Nepal would be especially alarming to India, given that India and Nepal share a long and deliberately porous border.