A judge has demanded an inquiry after the trial of a rape-accused student collapsed because crucial evidence proving his innocence had not been disclosed by police.

Liam Allan, 22, was on bail for almost two years and spent three days in the dock at Croydon Crown Court before the trial ceased on Thursday.

The judge called for an inquiry at the “very highest level” of the Crown Prosecution Service and a review of disclosure of evidence by the Metropolitan Police, The Times reported.

Police are understood to have looked at thousands of phone messages when reviewing evidence but it was not until the prosecution was close to trial that Met officers disclosed messages between the complainant and her friends which cast doubt on the case against Mr Allan.

The Crown Prosecution Service (CPS) said they offered no evidence in the case on Thursday, as it was decided "there was no longer a realistic prospect of conviction".

Speaking outside court, Mr Allan told The Times: "I can't explain the mental torture of the past two years. I feel betrayed by the system which I had believed would do the right thing - the system I want to work in."

A Scotland Yard spokesman said: "We are aware of this case being dismissed from court and are carrying out an urgent assessment to establish the circumstances which led to this action being taken.

"We are working closely with the Crown Prosecution Service and keeping in close contact with the victim whilst this process takes place."

A spokesman for the CPS said: "A charge can only be brought if a prosecutor is satisfied that both stages of the Full Code test in the Code for Crown Prosecutors are met, that is, that there is sufficient evidence to provide a realistic prospect of conviction and that a prosecution is required in the public interest.

"All prosecutions are kept under continuous review and prosecutors are required to take account of any change in circumstances as the case develops.

"In November 2017, the police provided more material in the case of Liam Allan. Upon a review of that material, it was decided that there was no longer a realistic prospect of conviction.

"Therefore we offered no evidence in the case against Liam Allan at a hearing on December 14 2017.

"We will now be conducting a management review together with the Metropolitan Police to examine the way in which this case was handled."

Writing in the Times, prosecuting barrister and former Conservative MP Jerry Hayes said: "I told the judge that this was the most appalling failure of disclosure that I have ever encountered.

"The CPS are under terrible pressure, as are the police. Both work hard but are badly under-resourced.

"Crown court trials only work because of the co-operation and goodwill of advocates and the bench - but time pressures are making this increasingly difficult.

"Because of the swingeing cuts that the Treasury continuously imposes, the system is not just creaking, it is about to croak."