India is set to offer Nepal a landmark pact to help develop its huge hydro-electric power potential as the South Asian giant takes another step to re-assert influence among smaller neighbours where China has been forging closer ties.

Prime Minister Narendra Modi, who went to Bhutan last month on his first overseas trip since coming to power, will soon visit Nepal, which has recently been questioning its position in India's sphere of influence.

Modi's foreign minister, Sushma Swaraj, heads to Kathmandu on Friday to prepare the way for Modi's August visit, the first by an Indian prime minister in 17 years.

The deal to kickstart energy power projects stalled since the Himalayan country drifted into civil war in 1996 will be squarely on the agenda of her talks.

But India's push on energy has ruffled some feathers.

Both Nepal's opposition Maoists, who have long sought to check Indian influence, and members of the ruling Nepali Congress party say the Indians are trying to lock them into an unequal treaty designed to shut out China to the benefit of Indian companies. "The draft impinges on the sovereign right of Nepal to allow investors other than India in the development of hydropower and renewable energy," said a former Nepali water resources minister, Lakshman Ghimire.

Modi came to power on a promise to make India an economic and military power and his invitation to all South Asian leaders to attend his inauguration was a signal of his regional aims.

While India under its previous government struggled with policy paralysis and a slowing economy, China was building ties with its neighbours including Nepal, by helping the army and police and building roads and power projects. In 2012, China's three Gorges International Corp won a contract to build the 750-MW West Seti dam.

While India remains the largest foreign direct investor at $441 million as of July 2014 compared with China's $228 million, the gap is narrowing, according to Nepali figures.

China and India fought a border war in 1962 and border disputes still cloud ties. India and Nepal, on the other hand, have a 64-year-old friendship treaty under which they share an open border and Nepal's citizens are free to work in India.

READ MORE: Narendra Modi sarkar has not done enough for power sector, so what are the stocks celebrating for?

PROFIT FROM POWERBut over the decades, India has seen its position eroded, partly by resentment in Nepal of perceived meddling in the country's internal affairs.

India says it has become a whipping boy for Nepal's fractious politicians, who have been unable to agree on a constitution since the end of the monarchy in 2008, choking off growth and driving tens of thousands of Nepalis abroad to work.

The energy agreement is aimed at speedy construction of hydro-electric projects, with either 100% Indian investment or joint ventures with Indian companies.

Nepal is estimated to have the potential to generate 40,000 MW of power, but it has installed capacity of just 600 MW and suffers blackouts for up to 18 hours a day.

Even tiny Bhutan produces more electricity from rivers cascading down its mountains and is aiming to ramp up capacity to 10,000 MW by 2020 from 1,480 MW, with Indian investment.

"Bhutan is prospering mainly due to the revenue generated from hydropower, while Nepal's economy is paralysed because of a lack of power," said an Indian official involved in the negotiations on the power pact. "Hydro electricity has the potential to transform Nepal, make it one of the richest countries in the region."

The deal outlines cooperation on energy trading and on transmission lines and grid connectivity and in no way curbs Nepal's right to develop its resources, said the official, who declined to be identified.

India also has security concerns, in particular that Islamists could exploit Nepal's instability to use it as a base from which to infiltrate into India. India hopes the talks will bring progress on an extradition treaty to deter anti-India militants from seeking refuge in Nepal.

With the centrist Nepali Congress in charge in Kathmandu after the Maoists, India had a better chance of improving ties, said Alyssa Ayres, a former U.S. State department official and a South Asia expert at the Council on Foreign Relations. "Given the increasing Chinese footprint in Nepal - as a development partner, foreign investor, military supplier and a power increasingly shaping how Nepal treats Tibetan refugees -India would surely want to shore up its own ties to ensure Indian influence doesn't dissipate," Ayres told Reuters.

(Additional reporting by Frank Jack Daniel; Editing by Robert Birsel)