A far-right extremist waved his knife and told shocked onlookers they had “better move back” as he killed MP Jo Cox, a court has heard.

Thomas Mair, 53, is accused of repeatedly shooting and stabbing the 41-year-old Remain campaigner a week before the EU referendum vote.

The mother of two was set upon outside her constituency surgery in Birstall in front of her staff and shocked residents on June 16.

Her assistant stepped in and hit Mair with her handbag, while 78-year-old Bernard Carter-Kenny desperately tried to intervene but was stabbed too, the Old Bailey heard.

Taxi driver Rashid Hussain pulled up at around the same time as Mrs Cox’s arrival at Birstall library in a silver Vauxhall Astra.

Still from CCTV footage issued by West Yorkshire Police showing Thomas Mair, who is accused of the terror-related murder of Labour MP Jo Cox

As he was giving his fare her change, he heard what sounded like a “firecracker”, jurors were told.

Mr Hussain said: “I just gave the change back and then because everybody was going towards the library I parked my car there.

“I walked towards the entrance and see the guy stabbing somebody ... behind the car. He was just standing up and he was in the road.”

The witness said he saw the man stab the Batley and Spen MP five or six times.

Mr Hussain said: “He said: ‘Move back, otherwise I’m going to stab you’.

“He was standing there with two ladies and another man. He said ‘better move back’.

“He shot twice. He moved back and shot again.”

Undated West Yorkshire Police handout photo of a gun that was presented in evidence during the trial of Thomas Mair, who is accused of the terror-related murder of Labour MP Jo Cox.

David Honeybell, who had gone to see Mrs Cox before her surgery, told jurors that after the attack the man calmly walked away.

He said: “He just walked away with not a care in the world, he just walked away.”

On Wednesday the court heard that Mair told two police officers “it’s me” moments before the unarmed pair rugby tackled him to the ground after Jo Cox was murdered.

West Yorkshire Pcs Craig Nicholls and Jonathan Wright both told the Old Bailey he also said “I’m a political activist” after they had detained and cuffed the alleged killer.

When Pc Wright looked in the bag Mair was carrying, he saw a sawn-off .22 rifle later found to be loaded with live ammunition, a dagger-style knife and an EU referendum leaflet amongst other items.

Undated West Yorkshire Police handout photo of a knife that was presented in evidence during the trial of Thomas Mair, who is accused of the terror-related murder of Labour MP Jo Cox

They were on patrol in a police car on June 16 when they spotted Mair around a mile from where the MP was attacked, the Old Bailey heard on Wednesday.

Mair denies Mrs Cox’s murder, possession of a firearm with intent to commit an indictable offence and possession of an offensive weapon - a dagger.

He has also pleaded not guilty to causing grievous bodily harm with intent to Bernard Carter-Kenny on the same date.

The trial continues.