A rape trial against a student spectacularly collapsed after texts emerged from the alleged victim in which she told a friend the sex 'wasn't against my will'.

Liam Allan, 22, was 'dragged through hell' for two years after police failed to provide messages proving his innocence to his defence team.

In the texts, the alleged victim asked for more sex after the attack was said to have taken place.

And one of the messages irrefutably cleared Mr Allan.

Sent to a female friend during a discussion on her sexual experiences with Mr Allan on September 3 2015, before she had made a complaint, the accuser said: 'It wasn't against my will or anything.'

Liam Allan spent almost two years on bail before police handed over text messages that exonerated him. He now plans to sue the police and the CPS

Liam Allan, 22, was standing trial when his lawyers discovered text messages from the alleged victim asking for more sex after the attack was said to have taken place

This is the bombshell text message that would have cleared a student accused of rape before he had to endure two years of hell

The texts held by police should have been made available to both the defence and the prosecution almost two years ago but were not due to 'sheer incompetence.'

And it has emerged Mr Allan, a psychology student at Greenwich University, is planning to sue the police and the CPS for their bungled handling of the case.

His lawyer Simone Meerabux told the Sun on Sunday: 'Mr Allan lost two years of his life because of gross negligence.

'We are considering legal action against the police and the CPS.'

Confirming he has ‘no choice’ but to sue the police and CPS, Mr Allan added: ‘I am however, happy to work with the CPS and police to help ensure things change for the better. In this case no individual is to blame; there are multiple factors.’

News Mr Allan was planning to sue comes as the detective accused of failing to disclose the vital evidence in the rape trial recommended months ago that the defendant should not be charged, it was claimed last night.

Mr Allan claims the heavily criticised officer who led the investigation – Detective Constable Mark Azariah – suggested to him in February that the case against him was weak.

The startling development came as calls mounted yesterday for an independent inquiry into the scandal. There were claims that dozens of cases have collapsed in recent years because of police failings over the way they handle evidence.

Mr Allan, from Beckenham, South East London, said: ‘I rang [Det Con Azariah] in the last week of February seeking an update. At this stage, I hadn’t been charged but it was more than a year since my arrest.

REVEALED: THE DETECTIVE WHO SAT ON CRUCIAL EVIDENCE... INVESTIGATOR: Metropolitan Police officer DC Mark Azariah This is the Detective Constable who led the police investigation of an innocent student accused of rape. The Mail on Sunday has learned that he is Detective Constable Mark Azariah, 37, from the Metropolitan Police’s child abuse and sexual offences command. He has worked for the Met since at least 2009. The case collapsed when it emerged in court that police had failed to disclose a series of graphic messages from the accuser’s phone to friends in which she discussed her fantasies of extreme sex acts, including being raped. Prosecuting barrister Jerry Hayes later revealed that he had been told by police that the phone records – which included 40,000 text and WhatsApp messages – were not disclosable because they contained ‘very personal material; nothing capable of undermining the prosecution case or assisting the defence’. Mr Hayes said: ‘It appears the police officer in the case has not reviewed the disk, which is quite appalling.’ The judge demanded a review of disclosure evidence by the Met and called for an inquiry at the ‘very highest level’ of the Crown Prosecution Service. The accused, Liam Allan, said magnanimously of the detective who might have cost him the best years of his life: ‘I would like to make it clear that this man is not solely responsible for the failures of the system. He should not be used as a scapegoat.’ The Met said that the case was overseen by the officer’s line managers. DAMNING RAPE FANTASY MESSAGES September 2, 2015 To a male friend Accuser: ‘You clearly don’t love me because you keep revoking my sexual advances, have I got to drug you?’ September 3, 2015 Accuser: ‘People need 3 things in life: food, water and sex.’ Accuser: ‘Sometimes sex is the number 1 priority, I’m really not joking to be honest I always think with my d*** lol.’ Accuser: ‘You know it’s always nice to be sexually assaulted without breaking the law.’ September 3, 2015 To a female friend in an exchange discussing her sexual experiences with Mr Allan. Accuser: ‘It wasn’t against my will or anything.’ September 3, 2015 Accuser: ‘Love is nice but sex is essential. In all seriousness, I am so frustrated now there is zero chance of me lasting like nine months without sex? I’m struggling now. How the hell do people go months and months without doing it?’ October 12, 2015 To a male friend Accuser: ‘You sexy f***er. Male friend: The chocking [choking] I find it to [too] hot, guess we can be messed up together?’ On same date to female friend Accuser: ‘Well are you going to take me into the park and rape me? In the bushes.’ November 2015 A group WhatsApp conversation Woman friend: ‘You guys are so sweet I feel like raping you all.’ Accuser: ‘Well 18 is a special number and we love you.’ Woman friend: ‘Stop because I seriously will rape you in your sleep.’ Accuser: ‘I told you it’s fine, I’d consent.’ Advertisement

‘He said the case had gone high up within the Crown Prosecution Service and the decision would be theirs.

‘He said he recommended in his report to the CPS that I should not face charges. He didn’t expand on what he put in his report.’

Two hours later – ‘as I came out of a lecture’ – Mr Allan received a call to say he would be charged with six rapes and one sexual assault.

‘Having been given hope, my world was instantly turned upside down,’ he said.

Last Friday, the day after the trial collapsed, a series of messages from Mr Allan’s accuser were disclosed revealing her secret fantasies about being raped and choked during sex. These were in reference to another partner.

Prosecutors did not hand over the phone messages, saying they were ‘too personal’ to share and ‘not relevant’.

But The Mail on Sunday can today reveal the existence of another message referring directly to her sexual experiences with Mr Allan – which cast doubt on the girl’s story from the outset.

‘It wasn’t against my will or anything,’ she wrote in a text to a friend. It was sent before she made her complaint.

Mr Allan said: ‘This clearly undermines her case. Why didn’t we get to see this? It wasn’t too personal.’

The case was blown apart when other messages from the woman were found where she discussed rape fantasies with another partner

Speaking about the moment his lawyer told him the the case against him had collapsed, Mr Allen said: ‘Simone rang me on December 7. I was bracing myself for bad news because up until then it had all been bad news.

'She had told me that the CPS had decided to drop the whole case and for a second I was speechless and then I just started screaming the whole house down. And then everyone started coming round to the house to congratulate and hug me.’

Although Scotland Yard and the CPS are looking into what went wrong, the Independent Police Complaints Commission said it had not been asked to investigate any of the officers involved in the case.

Police sources pointed out that no investigation is carried out by one officer alone, ‘and this case, like all investigations, was overseen by the officer’s line managers’.

Calls are also growing for a wide-ranging, independent investigation into the disclosure system, as well as the failure of so many rape trials – which could see Director of Public Prosecutions Alison Saunders grilled by MPs.

Tory MP Nigel Evans, who was taken to court over false rape claims, added: ‘I hope the Justice Select Committee can hold a full inquiry into it. Lessons have to be learned’

Tory MP Nigel Evans, who was taken to court over false rape claims, added: ‘I hope the Justice Select Committee can hold a full inquiry into it. Lessons have to be learned.’

Bob Neill, chairman of the Justice Select Committee, said he will raise the matter of disclosure with the Attorney-General in the Commons this week, and that his committee could investigate it further.

He added: ‘I’m not at all convinced that the DPP has got a grip on it.’

Angela Rafferty, QC, chairwoman of the Criminal Bar Association, said that without the intervention of the barristers in court, Mr Allan ‘would have suffered an appalling miscarriage of justice’ because of the failure of police and the CPS.

She said the failure was ‘not an isolated incident’ and added that police and the CPS may have had ‘unconsciously bias’ towards people who report sex offences.

Last night, the Met said it was ‘urgently reviewing this investigation and will be working with the CPS to understand exactly what has happened in this case.’

The CPS said: ‘We will now be conducting a management review together with the Metropolitan Police to examine the way in which this case was handled.’