UK “yellow vest” protester James Goddard has denied harassing an MP and a police officer at a court hearing that descended into chaos.

A judge walked out of the packed trial at Westminster Magistrates’ Court as Mr Goddard’s supporters shouted insults about pro-Remain MP Anna Soubry and chanted “shame on you”.

Three supporters joined him in the dock during the adjournment, as “yellow vests” packed out the courtroom and protested outside in unprecedented scenes that sparked an official investigation by HM Courts and Tribunals Service.

Mr Goddard, 29, denied public order offences over two incidents during the pro-Brexit group’s protests in London.

He is accused of harassing Ms Soubry by following her, filming her and calling her a “Nazi” and “traitor” outside the Houses of Parliament on two occasions in December and January, the court heard.

Police separate clashing Brexit protesters outside Parliament Show all 11 1 /11 Police separate clashing Brexit protesters outside Parliament Police separate clashing Brexit protesters outside Parliament Anti-Brexit protester Steve Bray (left) and a pro-Brexit protester argue as they demonstrate outside the Houses of Parliament Getty Images Police separate clashing Brexit protesters outside Parliament A pro-Brexit protester argues Getty Images Police separate clashing Brexit protesters outside Parliament Police surround the pro-Brexit protester after he confronted Steve Bray, a pro-European protester Getty Images Police separate clashing Brexit protesters outside Parliament A leave supporter is spoken to by a police officer as he argues with a remain supporter, Steve Bray, outside Parliament PA Police separate clashing Brexit protesters outside Parliament MPs in Parliament are to vote on Theresa May's Brexit deal next week after her December vote was called off in the face of a major defeat Getty Images Police separate clashing Brexit protesters outside Parliament A leave supporter is spoken to by a police officer PA Police separate clashing Brexit protesters outside Parliament Police look on as anti-Brexit protesters demonstrate outside the Houses of Parliament. Getty Images Police separate clashing Brexit protesters outside Parliament Police hold back a leave supporter PA Police separate clashing Brexit protesters outside Parliament A police officer speaks with anti-Brexit protester Steve Bray Getty Images Police separate clashing Brexit protesters outside Parliament Police surround a pro-Brexit protester after he confronted a pro-European protester Getty Images Police separate clashing Brexit protesters outside Parliament Conservative MP David Davies, wearing a gopro camera, speaks to anti-Brexit protester Steve Bray Getty Images

Mr Goddard is also charged with the racially aggravated harassment of a police officer on 7 January, and a public order offence of causing harassment, alarm or distress.

The defendant, of Altrincham in Greater Manchester, pleaded not guilty to both offences and is expected to rely on a defence of “fair comment”.

Addressing judge Kenneth Grant from the dock, Mr Goddard said: “It’s not illegal to heckle an MP. All of this is wrong.”

His supporters clapped and cheered, while shouting for Mr Goddard to sack his defence lawyer.

Mr Goddard asked “why?” when told to stand for the charges to be read, and gave his nationality as English but refused to give his address due to the “vultures” in court.

Judge Grant temporarily adjourned the case and left the courtroom 15 minutes into the hearing, after “yellow vests” in the public gallery started shouting about Brexit, made derogatory comments about Independent Group MP Ms Soubry and chanted.

Supporters of James Goddard outside Westminster Magistrates’ Court on 19 March (PA) (Dominic Lipinski/PA)

The case resumed briefly to inform Mr Goddard of his bail conditions but descended into chaos again as the defendant left the dock.

He asked to make a speech at the end of the hearing but was refused permission, and members of the public gallery repeated “shame on you” as the hearing came to an abrupt end.

Mr Goddard was freed on bail until a two day trial scheduled for 19 July at Westminster Magistrates’ Court.

An HM Courts spokesperson said: “The safety and security of all court users is our priority and we’re deeply concerned to hear of intimidating behaviour at Westminster Magistrates’ Court this morning.

“We apologise to all those affected and are urgently investigating what happened. This sort of behaviour will not be tolerated.”

After the hearing, a group of “yellow vests” travelled to the attorney general’s office in Westminster and stormed the building.

Protesters, including members of a group who claim a drink-driving crash that killed three teenagers was a deliberate attack, roved through corridors and pounded on doors while chanting and shouting.

The Metropolitan Police said officers were called to the scene but made no arrests during the incident, which lasted for around two hours.

Regular “yellow vest” protests started in December, seeing supporters block bridges and scuffle with police.

Demonstrators have heckled journalists and pro-Remain protesters in Westminster, and targeted several government buildings and institutions including the Cabinet Office, Downing Street, Labour Party and LBC radio.

Weekly Saturday rallies have also spread from London to other British towns and cities, mirroring the format of “yellow vest” protests that have seen violence and riots in France.