"The attack on the Afghanistan Parliament is a despicable and cowardly act. There is no place for such attacks in a democracy," Modi tweeted.
"My prayers are with those injured. We stand shoulder to shoulder with the people of Afghanistan in this hour," he said.
All seven Taliban militants who attacked the Afghan parliament were killed in a gun battle with security forces. At least 21 people were wounded.