At the restricted session of the Shanghai Cooperation Summit in the Chinese city of Qingdao, PM Modi said the worsening situation in Afghanistan was "an unfortunate example" of terrorism.
India and Afghanistan accuse Pakistan of plotting terror attacks in their countries.
"All parties in the region should respect the sentiment with which (Afghan) President Ghani has taken courageous steps for peace," PM Modi said.
He said it was "our common responsibility to ensure that reasons that threaten Afghanistan's sovereignty and security are not repeated".
PM Modi also talked about connectivity projects and said India was all for such programmes provided they respect the country's sovereignty and territorial integrity.
"We have again reached a stage where physical and digital connectivity is changing the definition of geography. Therefore, connectivity with our neighbourhood and in the SCO region is our priority," PM Modi said.
"We welcome any new connectivity project, which is inclusive, sustainable and transparent and respects country's sovereignty and regional integrity. India's active participation in the development of international North-South Transport Corridor, Chabahar port, shows our commitment," he added.
He also talked about regional security.
He coined an acronym for the word SECURE: 'E' for economic development, 'C' for connectivity in the region, 'U' for unity, 'R' for respect of sovereignty and integrity and 'E for environment protection.
Get the latest election news, live updates and election schedule for Lok Sabha Elections 2019 on ndtv.com/elections. Like us on Facebook or follow us on Twitter and Instagram for updates from each of the 543 parliamentary seats for the 2019 Indian general elections. Election results will be out on May 23.