The clock read 10pm when criminal defence barrister Julia Smart sat down at her kitchen table with a cup of mint tea and opened her laptop to work.

Dinner eaten, husband and three young children in bed and exhausted after a stressful day in court, the task ahead felt overwhelming.

But the fate of one young man accused of rape lay in her hands.

Female barrister Julia Smart helped clear student Liam Allan of rape after she found text messages showing the complainant discussed fantasies of violent sex, including being choked during intercourse

It was down to her as his lawyer — and her alone — to avert a potential miscarriage of justice. Sleep could wait.

On a PDF file were 2,500 A4 pages containing 40,000 text messages — downloaded by police from the alleged victim’s mobile phone — to sift through.

The next time Julia Smart looked up it was 4am. Somehow, she’d found the ‘gold dust’, the ‘smoking gun’ which would prove beyond all doubt Liam Allan’s innocence and blow the prosecution case ‘out of the water’.

‘I couldn’t believe what I was seeing. I managed to grab three hours’ sleep and was straight back in court where I told Liam what I’d found,’ says Julia, 48.

‘He simply put his head in his hands and cried: “I can’t believe it.”

‘Apart from a short text conversation between Liam and the complainant submitted as evidence, this disc of downloads hadn’t been disclosed to the defence, which the Crown Prosecution Service has a duty to do, until the first day of the trial.

‘I thought: “What other messages are there that we don’t know about?”

‘From Liam’s arrest we’d been told there were no messages between Liam and the complainant and the material from her phone was just personal “girlie chat” which was not relevant and therefore couldn’t be disclosed to us.

‘All the police had, I was told, was one page of Snapchat messages which were utterly innocuous, so of no value to anyone at all.’

In one text to a friend, three months before her January 2016 complaint to police, she said of sex with Liam: ‘It wasn’t against my will or anything’

But nothing, as we all know now, could have been further from the truth.

Despite telling police she didn’t like being intimate with men, text and social media messages recovered from the complainant’s phone told a different story.

In conversations with friends, she discussed fantasies of violent and extreme sex, including being choked during intercourse.

In one text to a friend, three months before her January 2016 complaint to police, she said of sex with Liam: ‘It wasn’t against my will or anything.’

Today, undergraduate Liam, 22, is a free man.

All six charges of rape and six charges of sexual assault were dropped following a CPS review of the evidence after Julia successfully halted his trial at Croydon Crown Court by alerting Judge Peter Gower to the existence of the messages.

Julia successfully halted his trial at Croydon Crown Court by alerting Judge Peter Gower to the existence of the messages and all charges were dropped following a CPS review

Liam professed his heartfelt thanks to Julia for working so doggedly through the night to clear his name.

He had always insisted sex with the complainant was consensual and that the ‘troubled’ woman only went to the police when he ended their relationship after starting at Greenwich University.

Had he been convicted, Liam would have faced up to 12 years in jail and would have been placed on the sex offenders’ register for life.

He says he has ‘no choice’ but to sue the Metropolitan Police, which this week launched an investigation into their handling of the case, and the CPS

In the two years he was on bail facing trial — which he described as a ‘terrible form of limbo . . . I can’t explain the mental torture’ — police were in possession of evidence that completely exonerated him.

Liam faced up to 12 years in jail and would have been placed on the sex offenders’ register for life if he had been convicted

‘I don’t know if the investigating officer read all the messages or not, but individually and collectively, they demonstrated his innocence,’ says Julia.

‘There was no crime. He should never have been charged. He went through hell for nothing.’

It was on the first day of Liam Allan’s trial at the end of November that she first noticed with alarm that the prosecution had included as evidence a short chain of text conversations between her client and the complainant which hadn’t been disclosed to his defence.

She immediately raised the issue with prosecuting barrister Jerry Hayes, who had taken over the case that weekend.

Mr Hayes, former Tory MP for Harlow, Essex, said ‘alarm bells started ringing’ when DC Azariah confirmed there was a download but said there was nothing to disclose

He was unaware of any police download from the complainant’s mobile phone and questioned the investigating officer, DC Mark Azariah, who was in court.

Mr Hayes, former Tory MP for Harlow, Essex, said ‘alarm bells started ringing’ when DC Azariah confirmed there was a download but there was nothing to disclose because the material was too ‘personal’.

After briefly examining the download, Mr Hayes passed it to Julia Smart to review before her cross-examination of the complainant.

‘I was absolutely absorbed all that time, looking through all these messages while at the time thinking: Why am I doing the investigating officer’s job at the 11th hour?’ says Julia, who is married to fellow lawyer Trevor Siddle. They have three children aged 14, 12 and nine.

‘I was investigating my own case to prove my own client is an innocent man, when, if the police had reviewed them properly, no charges would ever have been brought. If I’d accepted what the police had told me, scrolled through the first few pages and taken the view it was just all girlie chat, I could have been in bed by 11pm.

‘I could have said to Liam: “I can’t find anything. Let’s crack on,” but it’s cases like these that make you feel sick to the stomach as a defence barrister — knowing that if you don’t put in the hours, often unpaid, you might miss something and an innocent man could go to prison.

‘I knew that within those 40,000 messages of “girlie chat” there could be something explosive. In six hours I only managed to scale the tip of the iceberg and the next day I asked the judge for more time and both Liam and I went through them again to find more, so he was in the position of having to investigate his own case.

‘If we hadn’t examined that disc of downloads, it could have been a very different story for Liam. Even worse, there are other men, just like him languishing in jail right now.

‘Absolutely, there will be individuals who’ve had trials where material wasn’t disclosed. They may not even know it existed.’

Julia, a criminal defence barrister for 24 years — the past five with Furnival Chambers — says that between 50 and 75 per cent of her caseload involves defending those accused of sex crimes.

‘This is not the first time I or other barristers have found something. It just happens to be the first time this has been brought out into the open.

‘I don’t know if it’s because of economics and funding cuts or a mindset in the police that if they have a “victim”, that victim needs justice and the only way to obtain that is to secure a conviction.’

Director of Public Prosecutions Alison Saunders (pictured) described what happened to Liam as ‘regrettable’ and said she would ‘like to apologise to all parties involved’

Julia says non-disclosure is a constant battle for defence barristers — especially in rape and sexual assault cases where the drive to remedy past failings and push up woeful conviction rates has, in her view, created a ‘sales target’ culture where ‘believing the victim’ now trumps objective and thorough investigation.

She argues that the police and the CPS are, in her experience, failing in their responsibility to investigate every claim objectively and disclose vital evidence which could assist the defence while ‘cherry picking’ from material they hold to strengthen the prosecution case.

The Director of Public Prosecutions Alison Saunders described what happened to Liam as ‘regrettable’ and said she would ‘like to apologise to all parties involved’.

Scotland Yard is reviewing hundreds of rape, child abuse and sexual assault cases after a second prosecution collapsed earlier this week.

Julia says she has watched ‘victim-centred justice’ — first championed by New Labour and now entrenched in the British legal justice system — result in either unfair convictions or the life-long shame of being publicly accused of rape, despite an acquittal.

‘Once a man is convicted of a sex crime, it is very difficult to get him out of prison,’ says Julia. ‘You may not even know if such material exists. If we hadn’t found out about that disc, it could have been very different for Liam.

‘Without such evidence, facing a jury — even if the case is weak — can be a lottery. All it takes is a bad jury, having a bad day and a young person’s life is effectively ruined. The consequences are dire.

Another recent ‘rape shambles’ occurred when a Tory MP’s aide, Samuel Armstrong, 24, was cleared of attacking a young woman who claimed he’d raped her after a night drinking in Westminster

‘What happened to Liam Allan is not “regrettable”, it’s absolutely monstrous. It’s shocking and there needs to be a root and branch investigation into how we investigate such cases and disclose evidence.

‘This case has had worldwide coverage because we supposedly have the best justice system in the world, but if that’s the position, how on earth can we have a Liam Allan and others?

‘These cases are not in isolation. I have ongoing cases which have a frighteningly similar pattern to Liam’s, and so do many of my colleagues in chambers. I have had previous cases where material has been disclosed at the 11th hour over something fundamental.

‘I can’t talk about the psychology of those who make false accusations, but I do know that once a complaint is made and video evidence is recorded it is very difficult for a complainant to withdraw their allegations without facing prosecution.

‘The whole thing snowballs. You can’t just go into a police station and say: “I was in a bit of an emotional mess at the time, I want to take it back.” The alleged victim is assigned a police support officer. There’s no going back.

‘But it’s for the police to investigate all the evidence thoroughly and objectively and I don’t want to be that person sat there at 4am trawling through this material, knowing if I miss something there will be a miscarriage of justice.’

Isaac Itiary, 25, charged with rape of a child under 16, spent four months in prison awaiting trial until charges were dropped after police failed to disclose texts showing his alleged victim routinely posed as a 19-year-old.

Julia commended Liam's suggestion that two police officers should be assigned to every case — one to investigate the complainant’s account and another to investigate the defendant’s to ensure objectivity

And on Thursday there were reports of another ‘rape shambles’ when Tory MP’s aide, Samuel Armstrong, 24, was cleared of attacking a young woman who claimed he’d raped her after a night drinking in Westminster.

Messages eventually recovered from her phone, after nine months, revealed how she’d contacted a journalist just hours after the incident to secure a ‘sympathetic’ write up. Her medical notes also disclosed significant mental health issues.

Julia supports Liam’s call for anonymity for defendants accused of sex crimes unless proven guilty. She also commends his suggestion that two police officers should be assigned to every case — one to investigate the complainant’s account and another to investigate the defendant’s to ensure objectivity, and a senior officer to then review all the evidence.

‘The complainant has anonymity for life, but for Liam this will be the first thing that comes up whenever his name is Googled,’ says Julia. ‘It will leave its footprint forever.

‘Some people might argue that those defendant rights should apply to all crimes, but it’s the opprobrium and cloud which hangs over sexual offences that make this an issue. It’s almost as if, once someone has been accused of rape, you can’t look at them in the same way.

‘I know for Liam, his nearest and dearest and all his friends absolutely supported him, but in the minds of the public this special category of offences is different. Other offences don’t hang over you like that.’

As for Julia, from the moment she first met Liam Allan at his first Crown Court appearance where he left the dock in tears, she has never doubted his innocence.

‘He is a lovely young man, very genuine and respectful,’ she says. ‘When all the charges were dropped he asked me: “Am I allowed to give you a hug?” And I said: “Of course you are!”

‘When I took on his case, I defended Liam as if he were my own son because if this can happen to him, it can happen to anyone.’