Image copyright Getty Images Image caption Tommy Robinson arrives at the Old Bailey in London

A judge retrying ex-English Defence League leader Tommy Robinson for contempt of court has referred the case to the government's top legal adviser.

Mr Robinson faced an allegation that he had committed contempt by filming people before a criminal trial.

But Judge Nicholas Hilliard QC ruled the case needed to be referred up to the attorney general to decide.

The brief appearance was the latest in a long-running case that began in 2017.

The 35-year-old - who appeared under his real name, Stephen Yaxley-Lennon - was released on bail.

About 1,000 of his supporters, plus some opponents, gathered outside the Old Bailey court in London.

Image copyright Getty Images

After the hearing, Mr Yaxley-Lennon told the cheering crowd: "I shouldn't face another trial. I've been here three times with a prison bag. I've kissed my kids goodbye three times."

But he welcomed the referral to the attorney general and said he hoped he "makes the right decision".

The attorney general has the power to discontinue the case.

'Jubilant' crowds in song at the Old Bailey

By Dominic Casciani, BBC home affairs correspondent

Image copyright Getty Images

This is the second time the allegations against Mr Yaxley-Lennon have been heard at the Old Bailey - and the second time a decision on the case has been postponed.

It is also the second time that hundreds of his supporters have turned out - perhaps even more than before - and that the City of London Police have run a significant public order operation to contain both supporters and a smaller counter-demo.

He arrived in the security cordon flanked by his closest advisers from his days running the English Defence League to loud cheers and chanting.

Some supporters were carrying far-right banners - including two banners from organisations which are considered to be highly Islamophobic.

Office workers in the swish buildings around the Old Bailey and a fair few court staff looked on from above.

One of the most unexpected episodes this morning came when they began singing "How they Rule Ya" to the tune of Leonard Cohen's Hallelujah.

After the case, his supporters were jubilant, hailing him as some kind of martyr for free speech.

What did the judge say?

Mr Yaxley-Lennon's counsel, Richard Furlong, said the case should be referred to the attorney general - currently Conservative MP Geoffrey Cox.

Judge Hilliard then confirmed the case would be referred up, saying the matter was so complex it needed further consideration. The move would also allow lawyers to cross-examine witnesses.

Judge Hilliard added: "All the evidence must be rigorously tested."

What happens next?

Now the case has been referred to the attorney general's office, who will decide whether to send the case to the High Court or to drop the contempt proceedings.

The attorney general's office confirmed there was no set timescale for this decision to be made.

Image copyright Reuters Image caption Mr Yaxley-Lennon addressed the crowds outside the court before his hearing

Why was he in court?

In May 2017, Mr Yaxley-Lennon filmed four men outside a court, who were later convicted of gang-raping a teenage girl.

The trial was subject to reporting restrictions, and a judge at Canterbury Crown Court gave him a three-month suspended sentence for contempt of court.

In May 2018, he was jailed for potentially prejudicing a court case after broadcasting on social media outside Leeds Crown Court.

He was sentenced to 13 months - 10 months for the contempt of court in Leeds and a further three months for breaching the previous suspended sentence.

Mr Yaxley-Lennon appealed against both contempt findings.

Three judges quashed the Leeds ruling, saying the judge should not have commenced contempt proceedings that day.

They ordered the case be reheard so that the allegations could be fully examined and, after a brief appearance at the Old Bailey in September, the case was adjourned until today.

Mr Yaxley-Lennon says the whole thing is a "political witch-hunt" designed to stop him telling the truth about what he calls "Muslim rape gangs".

The anti-Islam campaigner described the media as the "enemy of the people" and blamed the government, police and social services for "sacrificing a generation of our daughters at the hands of the multiculturalism altar".

Supporters, some of whom are funding his legal campaign, cheered Mr Robinson outside Central Criminal Court.

Criticism of MR Robinson came from a group of anti-racism campaigners who were also outside the court.

One woman said: "He [Mr Yaxley-Lennon] was the [co-]founder of the English Defence League, which is a fascist party, and we've got to stop it.

"If people believe they're joining something that is a bit more innocuous they're wrong.

"The fact of the matter is not only is it racist, but a hard core of them are fascists."

Joe Mulhall of anti-racism group Hope Not Hate said: "He's dividing this country in a whole host of ways and, worst of all, he's dividing communities."

What is contempt of court?

Contempt of court laws are designed to protect the rule of law, ensure fair trials - and avoid trial by media.

Contempt can be committed by a broad range of people and organisations including the press, jurors, and social media users.

The maximum sentence for contempt of court is two years' imprisonment, but it can also be punished with a fine.

Read more about the contempt law from BBC Legal Affairs Correspondent Clive Coleman.