A "cascading series of errors" led to the bombing of an Air India airliner in June 1985, an inquiry in Canada has concluded.
Former Supreme Court Judge John Major, who led a four-year investigation, also called for better co-ordination between Canada's security agencies.
Air India flight 182, flying from Canada to India, plunged into the Atlantic killing all 329 on board.
Two Canadian men were tried in the case 20 years later and found not guilty.
Canadian police said the plane was bombed by Sikh militants fighting for an independent homeland in India.
"This was the largest mass murder in Canadian history," Mr Major said, delivering the investigation's final report.
"A cascading series of errors contributed to the failure of our police and our security forces to prevent this atrocity... various institutions and organisations did not fulfil their responsibilities."
He highlighted what he said were the poor relations between the Royal Canadian Mounted Police (RCMP) and the Canadian Security Intelligence Service (CSIS), adding that the prime minister's national security adviser should have greater powers.
"This is a crucial and fundamental requirement to achieve better co-ordination across the many agencies that have national security responsibilities," he said.
Mr Major said "error, incompetence, and inattention" occurred before the Air India flight and in the aftermath during the investigation and legal proceedings.
He said the CSIS and the RCMP were still focused on the threat of airline hijackings, not terrorism, and engaged in "turf wars" instead of sharing information.
Victims' relatives have long complained that police, as well as Canada's spy agency, ignored information about the plot that could have prevented the bombing, and then destroyed evidence in a botched investigation.
The report also criticises the Canadian government for claiming it has since fixed the security lapses.
"The commission rejects that position," Mr Major said.
The jet blew up in mid-air, plunging into the sea off the Irish coast and killing all on board - most of them Canadian citizens visiting relatives in India.
At about the same time, another bomb exploded prematurely in Japan, killing two baggage handlers.
Both explosions were linked to Canadian-based Sikhs retaliating for India's deadly 1984 storming of the Golden Temple, the holiest shrine in the Sikh religion.
It was not until 2005, after a series of setbacks in the investigation, that two Canadian men, Ripudaman Singh Malik and Ajaib Singh Bagri, were charged with a number of offences - including first-degree murder - for the bombing.
But after a two-year trial, both were acquitted on all counts because of a lack of evidence.
Another Sikh, Inderjit Singh Reyat, was jailed in the UK for 10 years in 1991 for his involvement in the Japan bombing.
In 2003 he pleaded guilty in a Canadian court to manslaughter in connection with the Air India bombing, and was sentenced to another five years in prison.