“Shocked to hear of (the) terrorist attack in London; condolences to bereaved families and prayers for recovery of injured,” the President tweeted.
He said India stood by the United Kingdom and “terrorism must be met through collective action by the international community”.
Modi said: “Deeply saddened by the terror attack in London. Our thoughts and prayers are with the victims and their families.
“At this difficult moment, India stands with the UK in the fight against terrorism,” he added, addressing British Prime Minister Theresa May.
On Wednesday, an attacker drove his vehicle and mowed down pedestrians on the iconic Westminster Bridge in the heart of London and another man knifed a policeman on the grounds of the Houses of Parliament.
Police said about 40 people were injured in the attack.