Former X Factor judge Tulisa Contostavlos condemned undercover reporter Mazher Mahmood, known as the Fake Sheikh, for "openly lying" to the judge and jury, as her trial for allegedly brokering a drugs deal collapsed.

Standing on the steps of London's Southwark Crown Court, the singer read out a statement which said: "This whole case was a horrific and disgusting entrapment by Mazher Mahmood and the Sun on Sunday newspaper.

"This whole case was a horrific and disgusting entrapment by Mazher Mahmood and The Sun on Sunday newspaper.

"Mahmood has now been exposed by my lawyers openly lying to the judge and jury. These lies were told to stop crucial evidence going before the jury.

"This evidence showed that I told Mahmood's driver that I disapproved of drugs, which is the truth.

"It is clear that the driver was pressurised to change his statement to strengthen Mahmood's evidence and cause damage to mine. Thankfully the lies have been uncovered and justice has been done."

Ms Contostavlos had vehemently denied brokering the deal, which was exposed in the Sun on Sunday last June.

Earlier, she heard judge Alistair McCreath tell the jury that the case "cannot go any further" because there were "strong grounds to believe" that Mr Mahmood had "lied" at a hearing before the trial started.

The 26-year-old star smiled broadly in the dock as the jury was formally discharged from trying the case.

She appeared ecstatic, punching the air as she left the dock before crying as she hugged supporters including her PA, Gareth Varey, shortly after the case against her was thrown out.

Outside the court, the singer urged the police to investigate Mr Mahmood and "put an end to his deceits" .

The Sun said the reporter has been suspended.

A spokesman said: "We are very disappointed with this outcome, but do believe the original investigation was conducted within the bounds of the law and the industry's code. This was demonstrated by the CPS decision to prosecute.

"The Sun, of course, takes the judge's remarks very seriously. Mr Mahmood has been suspended pending an immediate internal investigation."

The court heard that the collapse of the case hinged on evidence given by Mr Mahmood about a statement given to police by a driver called Alan Smith who picked up Ms Contostavlos from a hotel in London in May last year.

It can now be reported that, before the trial began, defence counsel argued that the case should be "stayed" - meaning thrown out - but their application was turned down.

But giving his ruling today, the judge said "matters have moved on since then".

Mr Smith originally suggested that he had heard the star talking disapprovingly about drugs but "changed his mind" after a conversation with the undercover reporter, the court was told.

During a pre-trial hearing, Mr Mahmood was asked: "Did you subsequently ask or find out, discuss with Mr Smith anything that was said in the car?"

He replied: "No."

Asked if at any stage he discussed Ms Contostavlos saying she "disapproved" of drugs, he also said no.

But the judge said he gave answers which were "entirely inconsistent" when he gave evidence about the same topic at the trial last week.

Explaining his decision to halt the case to the jury, the judge said: "Occasionally - very rarely - circumstances may arise in which a court has to say that, whatever apparent merits a prosecution may have, the court cannot allow the prosecution case to be taken forward to trial."

He said the situation arose from a "fundamental principle" that the court "cannot allow itself to be party to improper conduct".

The judge went on: "Where there has been some aspect of the investigation or prosecution of a crime which is tainted in some way by serious misconduct to the point that the integrity of the court would be compromised by allowing the trial to go ahead, in that sense the court would be seen to be sanctioning or colluding in that sort of behaviour, then the court has no alternative but to say 'This case must go no further'."

Mr Mahmood had told the former N-Dubz singer she was being considered for a leading role in a Slumdog Millionaire-type film tipped for Oscar glory alongside possible co-star Leonardo DiCaprio.

After the case collapsed Ms Contostavlos condemned Mr Mahmood and his team for showing her "no mercy".

In her statement she claimed she had been "tricked" and "targeted" at a time when things were going badly for her.

Mr Mahmood and his team, she said, had got her drunk to act the part of a ghetto girl. She thought she was auditioning for a part but this was recorded and used as evidence against her, she said.

She said: "It was a terrible thing to do.

"As my lawyer said at the outset, we have now succeeded in exposing the real culprits and, most importantly, the real liar.

"As someone who has had my life ruined for the last year, I strongly believe that this type of entrapment should not be allowed to happen to anyone."

She vowed to "use these experiences to make me stronger" and thanked everyone from her fans to her legal team, who had backed her through a "terrible ordeal".

Mike GLC - whose real name is Michael Coombs - pleaded guilty before the start of the trial to supplying half an ounce (13.9g) of cocaine but he also walked free after judge said the case could not proceed against him.

He admitted supplying the cocaine - which tests later showed was 37% pure - for £820.

Before the judge formally halted the trial Tim Cray, prosecuting, told the court the Crown "cannot identify any fact which is capable of countering the submissions that Mr Mahmood told a deliberate lie" during pre-trial proceedings known as a "voir dire" hearing.

During his testimony on that occasion Mr Mahmood said he had not "asked, found out or discussed" with Mr Smith anything that was said in the car during the journey from the Metropolitan Hotel on May 10 last year, the court heard.

He also denied discussing Mr Smith's statement that was "apparently favourable" to the singer because she had expressed "disapproval" of drugs, Mr Cray said.

But at trial, the reporter said he had discussed what was said in the car with Mr Smith and said the driver had sent him a copy of his statement, the prosecutor said.

Mr Smith had told Mr Mahmood there was a problem with his statement in that he could not remember who had made the comment disapproving of drugs and police had "told him to leave it", the court heard.

Mr Mahmood then advised him to tell police about the problem with the statement, the prosecutor said.

The alleged exchange was said to have taken place during the afternoon of June 24 - three days before Mr Mahmood gave evidence that he had not discussed Mr Smith's statement or evidence.

Mr Cray said: "There may be a number of reasons for the change in Mr Mahmood's evidence but the reasons for the change are secondary to what the evidence reveals about Mr Mahmood's honesty and his ability to manipulate the court's process."

The journalist's conduct during the voir dire hearing "created ... the question of whether it is fair for them (the defendants) to be tried at all".

Fazer, Tulisa's former boyfriend and N-Dubz bandmate, welcomed the ruling.

He tweeted: "Thank god for this!! @officialtulisa #Relieved."

Giving evidence last week, Mr Mahmood denied "manipulating" the singer after he told her she was being considered for a leading role in a Slumdog Millionaire-type film tipped for Oscar glory alongside possible co-star Leonardo Di Caprio.

The trial was halted before Ms Contostavlos was able to give evidence to put forward her defence to the allegations she has strenuously denied.

Both her barrister and the judge gave a summary of her case today.

Mr Dein said her evidence would have been "to the effect that throughout she believed that she was auditioning for a life-changing part in a film which might have been a major success".

He added: "She made incriminating comments which were not true.

"When she had said in Las Vegas that she did not involve herself with cocaine that was the truth and that what she said to Mr Smith was the truth, namely that she is adverse to drugs."

The judge also gave then jury an insight into what shape her case would have taken.

He said: "In essence it is this. She was taken in by Mr Mahmood and believed that a film part was coming her way.

"But things were said by him and others associated with him which made her think her chances of getting the part would be boosted if she made herself out to be a street-wise woman, familiar with and to some extent involved in drugs.

"That is why she spoke as she did on the 10th of May. And once she had adopted that role, it was very hard to step out of it, hence the texts and calls later in the month.

"She never intended that drugs should be supplied to him by Mr Coombs or by anyone else. Anything which he did in that regard was out of a misplaced desire on his part to help her out of her dilemma, not because she asked him to do it. This was something he did not intend and knew nothing about."

Here is the statement issued by Tulisa Contostavlos following the collapse of her drugs trial:

"Let me be perfectly clear. I have never dealt drugs and never been involved in taking or dealing cocaine.

"This whole case was a horrific and disgusting entrapment by Mazher Mahmood and the Sun on Sunday newspaper.

"Mahmood has now been exposed by my lawyers openly lying to the judge and jury. These lies were told to stop crucial evidence going before the jury. This evidence shows that I told Mahmood's long-standing driver that I disapproved of drugs, which is the truth.

"It is clear that the driver was pressured to change his statement to strengthen Mahmood's evidence and to damage mine.

"Thankfully the lies have been uncovered and justice has been done.

"This case only happened because Mahmood and his team tricked me into believing I was auditioning for a major movie role.

"They targeted me at a time when things were going badly for me and they had no mercy.

"Mahmood got me and my team completely intoxicated and persuaded me to act the part of a bad, rough, ghetto girl.

"They recorded this and produced this as evidence when I thought it was an audition. It was a terrible thing to do.

"As my lawyer said at the outset, we have now succeeded in exposing the real culprits and, most importantly, the real liar.

"As someone who has had my life ruined for the last year I strongly believe that this type of entrapment should not be allowed to happen to anyone.

"I urge both the police and News UK to investigate Mazher Mahmood and his team and to put an end to his deceit in pursuit of sensational stories for commercial gain.

"I have not been able to work for a year, and I am now looking forward to resuming my career.

"I will use these experiences to make me stronger. I would like to thank all the people who have supported me through this terrible ordeal, including my fans and, of course, my legal team."