The 42 megawatt Salma dam in western Herat province, bordering Iran, is one of two major projects carried out under India's development partnership with Afghanistan. India has poured more than $2 billion into the country since the Taliban was toppled from power in 2001.
Modi and Ghani jointly pressed a button to start the turbines at the dam as engineers released colourful balloons in celebration.
Narendra Modi to embark on a five-nation tour this weekend
"With the inauguration of the 'Afghanistan-India friendship dam' the first such large Indian-funded project is completed," Ghani said at the ceremony.
"We hope that this will lead to the development of many such projects."
Construction on Salma dam, which will boost Afghanistan's power capacity and help irrigate thousands of hectares of farm land, had been stalled by decades of fighting.
"Afghans and Indians dreamt of this project in the 1970s," Modi said.
"Today the brave Afghan people are sending a message that the forces of destruction, death, denial and domination shall not prevail."
New Delhi, the fifth largest bilateral donor in Afghanistan, has been a key supporter of Kabul's post-Taliban government, a stance that has led analysts to point to the threat of a "proxy war" in Afghanistan between India and Pakistan.
The Salma Hydroelectric Dam pictured at Chishti Sharif in Afghanistan's Herat province on June 2, 2016. PHOTO: AFP/FILE
Pakistan has long been accused of supporting the insurgents in Afghanistan, especially with attacks on Indian targets in the country.
In December, Modi inaugurated Afghanistan's new parliament complex in Kabul, built by India at an estimated cost of $90 million.
Narendra Modi to visit Afghanistan to open dam
A few days after his visit militants launched a 25-hour gun and bomb siege near the Indian consulate in Afghanistan's Mazar-i-Sharif city.
And in March, Taliban militants fired a barrage of rockets at the parliament complex.
But diplomatic relations between India and Afghanistan have grown despite those attacks.
The two countries recently signed a three-way transit agreement with Iran to develop its southern port of Chabahar, as Modi visited Tehran last month.
The deal, bypassing Pakistan to connect Iran, India, and Afghanistan to central Asia, would boost economic growth in the region, Modi said at the time.
COMMENTS (31)
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ