Hazrat Mirza Masroor Ahmad, the Caliph of the Ahmadiyya Muslim Community (AMC), said his "heartfelt sympathies" were with the victims.
He was speaking at a Peace Symposium held at the Baitul Futuh Mosque in Morden, south London on Saturday.
Five people died and 50 were hurt outside Parliament, last Wednesday.
In a message Prime Minister Theresa May praised the conference, which she called "an annual reminder of your community's commitment to promoting peace".
MPs Paul Scully and Siobhan McDonagh were among the hundreds who attended the event at the UK's largest mosque.
The caliph described the attack in central London a "barbaric atrocity".
"No matter what terrorists may claim, under no circumstances are indiscriminate acts, or killings ever justified," he said.
He added that Muslims and non-Muslims "must stand up against all forms of oppression, hatred and use all our capabilities to try and foster peace in the world."
Three people were killed in Wednesday's attack when Khalid Masood drove his car into pedestrians on Westminster Bridge, before stabbing to death unarmed PC Keith Palmer.
Masood was then shot dead by police.

A JCB spokesperson confirmed that the company had ended its membership of the CBI, but did not give reasons why.
Sky news had earlier reported that it was due to the group's response to the referendum outcome
JCB's chairman, Lord Bamford, was a prominent supporter of the Brexit campaign.
During the campaign he said: "The UK is the world's fifth largest trading nation. We therefore have little to fear from leaving the EU."
He also wrote to his 6,500 UK employees to explain why he favoured a vote to leave the European Union, saying he was "very confident that we can stand on our own two feet".
The CBI, on the other hand, warned that a UK exit from the EU would cause a "serious economic shock", potentially costing the country Â£100bn and nearly one million jobs.
A CBI spokesman said: "It's always a shame to see any member leave the CBI, but we recognise that businesses have competing priorities and we respect that."
A spokesperson for JCB said only: "I can confirm that JCB is ending its membership of the CBI."
The Sky report said that the Staffordshire-based company had ended the membership in the summer, after the referendum.

It's that time when clubs scramble to strengthen their squads, to find a player who can shoot them to glory or one who can save them from relegation.
Some are flops soon to be forgotten, while others go on to become club legends.
But who has been the best January signing? We are not just talking goals, but their value and contribution to the club.
Take a look at our shortlist below and decide for yourself.
Who do you think is the best January signing? Use the selector below to pick from our shortlist. Once you are done download your image and share with your friends.
The world leader of millions of Muslims has condemned the Westminster terror attack calling it an "affront to the teachings of Islam".
[NEXT_CONCEPT]
The construction firm JCB has left the business lobby group, the CBI, reportedly because of its anti-Brexit stance.
[NEXT_CONCEPT]
The January transfer window is about to close for another year.