Describing the case as 'exceptional', the court said it was 'clearly an abuse of process' for George Dean, 17, to be prosecuted after he had been led to believe that this would not happen.
Lawyers said the ruling, quashing a decision by Croydon magistrates to commit him for trial at the Old Bailey, raised matters of constitutional significance.
The Crown Prosecution Service is expected to appeal to the House of Lords.
Giving judgment yesterday, Lord Justice Staughton, sitting with Mr Justice Buckley, said George Dean had been charged with attempting to 'impede' a police investigation into the murder of Ronald Eades in March last year.
The charges came after he had made statements saying that he knew the culprits and had been taken by them to a wood near Croydon where Mr Eades was stabbed to death. He had admitted that had been responsible for burning the victim's Ford Granada car.
This evidence formed an important part of the case against two men later charged with killing Mr Eades. One had been found guilty of murder and sentenced to life imprisonment, and one had pleaded guilty to manslaughter but had yet to be sentenced.
George Dean said he had only made his confessions after being given 'specific assurances' by senior officers that he would not be prosecuted, the court was told.
Although the police denied this, George's evidence was supported by affidavits from his father and solicitor, the court was told.
Moreover, a representative from the CPS said she was aware that the police had 'stated to him that he would not be prosecuted'.
Lord Justice Staughton said: 'We are entitled to disregard the evidence of the police.'
The CPS maintained in court that even if assurances had been made by the police, they would be worthless in any case. The judge dismissed this argument.
He said: 'It was submitted on behalf of the CPS that they alone are entitled to decide who shall be prosecuted and that the police had no authority and no right to tell Mr Dean that he would not be prosecuted.
'I cannot accept the submission . . . that in consequence no actions of the police can give rise to abuse of process.
'If the CPS find that their powers are being usurped by the police, their remedy must surely be a greater degree of liaison at an early stage.'
Lord Justice Staughton went on to say that George Dean had been left with the impression that he would be a prosecution witness and not a defendant in the case.
Even after the decision was made to charge him, this impression was 'not dispelled for five weeks, during which time he gave repeated assistance to the police'.Reuse content