NEW DELHI, March 23 (Xinhua) -- India on Thursday condemned the terror attack on the British Parliament on Wednesday, in which at least five people, including the perpetrator, were killed and over 40 others injured.

Indian President Pranab Mukherjee and Prime Minister Narendra Modi both took to social media to express sadness over the terror attack, saying this country stands in solidarity with Britain.

"Shocked to hear of terrorist attack in London; condolences to bereaved families and prayers for recovery of injured. India stands by UK; terrorism must be met through collective action by international community," President Mukherjee tweeted.

On his part, Modi wrote on Twitter "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 Britain in the fight against terrorism."

There have been no Indian casualties in the attack, though the community has significant presence in Britain.

The terror attack took place Wednesday when a single attacker drove a grey Hyundai i40 along a pavement over Westminster Bridge, near the Houses of Parliament in central London.

The car then crashed into railings outside the Houses of Parliament. The attacker, armed with a knife, ran to Parliament where he was confronted by the police. A cop, who was not armed, was then stabbed and killed. The attacker was later shot dead by armed officers.

"The location of this attack was no accident... The terrorist chose to strike at the heart of our capital city where people of all nationalities, religions and cultures come together to celebrate the values of liberty, democracy and freedom of speech," British Prime Minister Theresa May said.