The family of a man found murdered 24 years ago with an axe embedded in his head has damned the entire criminal justice system as "not fit for purpose" after Scotland Yard admitted the killers had been shielded by police corruption.

It followed the collapse of the trial of three men accused of the murder of Daniel Morgan in 1987. The prosecution decided not to offer any evidence because it could not guarantee that the police could meet rules protecting the defendants' right to a fair trial. Charges against two other men had been dropped earlier.

Scotland Yard's hunt for Morgan's killers had to overcome the fact that the original murder inquiry had been hampered by police corruption.

One of those acquitted earlier in the current case was a former detective, Sid Fillery, who had been charged with perverting the course of justice. After the murder he replaced Morgan at Southern Investigations, the private detective firm Morgan ran with Jonathan Rees, who was accused of the murder and acquitted after the crown's case collapsed.

Brothers Garry and Glenn Vian were also acquitted, after the prosecutor had to admit police could not be relied upon to ensure the defence had access to any documents detectives may have which could be relevant to resisting the charges.

The case has cost an estimated £20m to £30m in investigations and trials over the last 24 years and a day since the murder.

Nicholas Hilliard QC, for the Crown, said his case was fatally undermined because some documents the defence wanted to see went missing, and 18 crates of papers were discovered by chance in a disused police building.

The prosecution was finally fatally flawed last Friday, Hilliard told the court with the Morgan family watching, when police found four more crates of material defence lawyers had not been told about, this time in offices used by the investigation team. Detectives say they made a genuine mistake, which once realised, they informed the court about. Pointedly members of the Morgan family shook the hands of detectives in court before the hearing, despite knowing the case was about to collapse.

A total of five investigations generated 750,000 documents, which were mainly uncomputerised, and the newly discovered crates contained documents relating to criminals who had turned supergrass – whom the prosecution wished to rely on, and whom the defence wanted struck out as too unreliable to go before a jury.

Mr Justice Maddison said that the vastness and complexity of the case was unusual and the crown was "principled" and "right" to drop the case. He said police had "ample grounds to justify the arrest and prosecution of the defendants".

He said the Morgan family had suffered "extreme distress" during the proceedings which had dragged on over 18 months of legal argument without the case ever getting to a jury.

The judge said: "They must have been confused as to why we were not trying whether or not the defendants were responsible for the murder of Mr Morgan, but were trying a large number of highly complex preliminary issues."

Outside court, the family called for a judicial inquiry into the handling of the case by the police, and CPS, and the failure to bring anyone before a jury. "The criminal justice system is simply not fit for purpose," they said.

The dead man's brother, Alastair, who spearheaded the family's 24-year campaign, said: "For much of this time, we have encountered stubborn obstruction and worse at the highest levels of the Metropolitan police. We have found an impotent police complaints system.

"And we have met with inertia or worse on the part of successive governments. We have been failed utterly by all of the institutions designed to protect us. "

Detective Chief Superintendent Hamish Campbell, head of Scotland Yard's homicide command, apologised to the family for the past police corruption: "This current investigation has identified, ever more clearly, how the initial inquiry failed the family and wider public. It is quite apparent that police corruption was a debilitating factor in that investigation. This was wholly unacceptable."

The fifth murder investigation was the first time Met detectives had used new legislation governing the handling of supergrasses, which was supposed to reduce the risk of corruption.

But during legal argument, officers were accused of crossing the line themselves.

Defence lawyers during legal argument accused police of coaching the main supergrass witnesses, and deliberately withholding vast quantities of evidence which detailed the Met's relationship with a corrupt police informant.

Campbell said the force would study the case: "There are important issues which we need to examine to understand what led to today's decision."

A senior police source added the handling of "historic" cases dating back decades needed to be reviewed: "We need to reflect on what we should be pursuing when there is only verbal testimony when there are no forensics. But you can't have a policy saying you'll never do it."

"The investigation was not out of control," he said, adding that it was overseen by experienced top officers including John Yates, Commander Simon Foy and Campbell.

Rees, a convicted criminal, attacked the police's conduct after his acquittal claiming they had ignored 40 other suspects and added: "One disgraceful aspect is that senior police purported to take seriously people with mental health problems and career criminals merely trying to benefit themselves."

At the 1988 inquest into Morgan's death, a Southern Investigations employee gave evidence implicating Rees.

In evidence to the hearing, Kevin Lennon said Rees wanted Morgan dead after a row: "John Rees explained that, when or after Daniel Morgan had been killed, he would be replaced by a friend of his who was a serving policeman, Detective Sergeant Sid Fillery."

Lennon also told the inquest that Rees said to him: "I've got the perfect solution for Daniel's murder. My mates at Catford nick are going to arrange it.

"He went on to explain to me that if they didn't do it themselves the police would arrange for some person over whom they had some criminal charge pending to carry out Daniel's murder."