The Crown Prosecution Service has publicly condemned UK police for missing evidence that ultimately exonerated a 17-year-boy of rape.

The boy was accused of rape in 2016 and expelled from school following his arrest. The boy, who was just 15 at the time, cannot be named because of legal reasons. He faced 14 charges including rape, sexual assault and sexual activity with a child.

According to The Times, the defence discovered 233 pages of Facebook conversations between the accused and alleged victim that proves their relationship was consensual. The prosecution did not present any evidence in the trial.

The conversation records were discovered by the defence in October but police failed to pass on the information to the Crown Prosecution Service until November. After the victim was reinterviewed, the prosecution decided to move forward with the case.

"We have a duty to keep cases under continual review," a spokesperson said, according to The Times. "In March 2017, as part of the charging decision, the CPS requested that police investigated social media interactions, but were informed that no messages existed. As a result of new material made available to the CPS in November 2017, further reviews of the case were undertaken."

Defence lawyer Katya Saudek told the court she would be demanding an investigation into the case. She told Judge Nicholas Dean, QC, that the case had been "dogged by catastrophic failings".

A spokesman for Leicestershire Police said they were "committed to reviewing the circumstances of the case". The spokesman added: "Social media investigations were carried out but initially nothing was found that had a bearing on the case. However, when further information later came to light it was acted upon immediately."

In December, Liam Allan was found innocent in similar circumstances after it was revealed police had withheld evidence. The trial of Allan dramatically collapsed after he spent two years on bail accused of six counts of rape and six counts of sexual assault by a woman who told police she does not enjoy sex.

Allan, 22, denied the accusations and claimed the woman was making the malicious claims because he was due to attend university and would not be able to see her anymore.

After spending three days in the dock, all charges against him were dropped after the prosecution made a shock announcement that the woman's phone records which police previously refused to hand over were finally disclosed and proved he was not guilty.