Modi said other countries may have a "sunset clause" but India's ties with Afghanistan remain "timeless".
"Our resources may be modest, but our will is boundless. For others, their commitments may have a sunset clause, but our relationship is timeless. We face barriers of geography and politics, but we define our path from the clarity of our purpose," he said in an address after inaugurating the Afghan- India Friendship Dam along with President Ashraf Ghani.
"It was a war not of Afghan making, but it was one that stole the future of an entire generation of Afghans," the Prime Minister said, adding that the brave Afghan people are today sending a message that the forces of "destruction and death, denial and domination" shall not prevail.
When Afghanistan succeeds in defeating terrorism, the world will be "safer and more beautiful", he said.
Also Read
The dam, earlier known as Salma Dam, has been built by India at a cost of Rs 1,700 crore on river Harirud in Chist-e- Sharif in western Herat neighbouring Iran. It will irrigate 75,000 hectares of land and generate 42 MW of power.
Resolving to stand by Afghanistan, the Prime Minister said India's cooperation will extend to "every part" of the war-torn country and that the partnership will benefit every section of Afghan society.
"In your clear eyes, I saw the deep well of affection for India. In your smiles, I saw the joy of this relationship. In the firmness of your embrace, I felt the trust in our friendship," Modi said.
"When our people are under attack, the brave Afghans guard us as their own. They put themselves in the line of fire so that their Indian friends are safe. This is the nobility of your heart and the strength of your friendship. I have seen this from the moment I assumed office as Prime Minister.
"For on that day, when terrorists launched a massive attack on our Consulate in this city of Herat, the heroic efforts of Afghan soldiers, and of our personnel, saved many lives and prevented a big tragedy," he said, referring to the 2014 attack on the Indian mission here.