The "cowardly" killer of Jo Cox repeatedly shouted "Britain First" as he shot and stabbed the Labour MP a week before the EU referendum, a court heard.

Gardener Thomas Mair, 53, allegedly murdered the 41-year-old outside her constituency surgery in Birstall, near Leeds, on June 16.

Opening his Old Bailey trial, Richard Whittam QC told jurors how mother-of-two Mrs Cox had supported the Remain campaign leading up to the referendum on June 23.

On the afternoon of Thursday June 16 2016, she was to hold a surgery in the library in Market Street, having visited a local school and a care home.

Mr Whittam told jurors: "As she arrived she was brutally murdered by one of her constituents, this defendant, Thomas Mair.

"It was a cowardly attack by a man armed with a firearm and a knife.

"Jo Cox was shot three times and suffered multiple stab wounds.

"During the course of the murder Thomas Mair was heard by a number of witnesses to say repeatedly 'Britain First'."

During the attack, a 77-year-old local man risked his own life in an effort to save hers, the court heard.

He was stabbed once by Mair with the same knife that he used to stab Mrs Cox.

Emergency services arrived within minutes and she was given an emergency thoracotomy as she lay in the street, the court heard.

The prosecutor told jurors: "The murder took place whilst she was performing her role as a Member of Parliament.

"Thomas Mair's intention was to kill her in what was a planned and pre-meditated murder for a political and/or ideological cause."

The defendant allegedly used a .22 gun adapted to kill and a dagger-like knife.

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.

Mair, from Birstall, also pleads not guilty to causing grievous bodily harm with intent to Bernard Carter-Kenny on the same date.

Mrs Cox's parents and sister sat in court as the prosecutor told jurors to apply cool logic in the "shocking" case.

The trial is being heard by senior judge Mr Justice Wilkie and is expected to go on for up to three weeks.

Items found at Mair's home in Lowood Lane, Birstall, showed he had "strong political and ideological interests", Mr Whittam said.

The court heard that Mair had used the computers at the same library in the weeks leading up to the killing to access websites.

In May, the prosecutor said, Mair accessed the Wikipedia page of an online publication called the Occidental Observer. Wikipedia described it as a "far-right" publication "that covers politics and society from a white nationalist and anti-Semitic perspective".

In the days immediately before the killing he returned to view more online material, the court heard.

On June 13, he looked at the Twitter and Wikipedia pages for Mrs Cox, and the Wikipedia page for Conservative Ian Gow, whose killing by the IRA made him the last sitting MP to be murdered until that point, jurors were told.

He went on to view information about former foreign secretary William Hague, another Yorkshire-based Remain supporter.

Mr Whittam said Mair also looked at information on .22 gun ammunition, including answers to the question: "Is a .22 round deadly enough to kill with one shot to a human head?"

The next day, Mair returned to look at websites on "matricide" - the murder of your own mother - Nazi material, the death penalty in Japan, political prisoners and the human liver and spinal column.

Jurors saw CCTV footage from the library showing Mair arriving to use the computers on June 15, the eve of the attack.

The prosecution alleges that late that afternoon he researched right-wing politicians as well as the Ku Klux Klan and civil rights activists killed by its supporters.

Mr Whittam said Mair also accessed sites covering "Israel and prominent Jewish individuals", Palestine, coffins, the Waffen SS and more information on .22 ammunition.

On the morning of the killing, Mair was seen by a neighbour leaving his home in Lowood Lane wearing a white baseball cap, green jacket and dark trousers.

Jurors were shown more CCTV footage of him making his way along the road.

Mrs Cox arrived for her surgery with her manager Fazila Aswat and senior caseworker Sandra Major at 12.50pm.

Mair launched his attack two minutes later in front of shocked passersby.

Mr Whittam described it as a "dynamic, fast-moving and shocking incident".

Shelly Morris, who was the first to call 999, reported hearing "a loud bang like a popping sound" and "a loud piercing scream", jurors were told.

She allegedly saw a man with a large steak knife with a jagged blade, which he wielded in a "stabbing motion".

The attacker stood over a figure and fired a gun twice, according to her account.

Ms Aswat saw Mair come up behind the MP and stab her, then shoot her with the gun.

He proceeded to attack Mrs Cox and Mr Carter-Kenny with the knife before firing again at the politician, Mr Whittam said.

Ms Aswat hit Mair repeatedly with her handbag but was forced to retreat.

She allegedly heard the defendant shouting: "This is for Britain, Britain will always come first."

Ms Major heard him say "we're British independence" and "Keep Britain independent", jurors were told.

Mr Carter-Kenny was stabbed after going to Mrs Cox's aid, the court heard.

He was waiting in his car outside the library for his wife Doreen when he saw the MP being attacked.

Mr Whittam said: "He saw Jo Cox, who he recognised, and he described the attack. He heard a bang and saw Jo Cox roll into the road and then he saw a man 'shoving it - a knife - at her'.

"He went to try and help. He was stabbed."

A local taxi driver, Rashid Hussain, saw what happened as he dropped off a fare.

The court heard that when he challenged Mair, saying "leave her alone", the defendant warned him: "You just go away, otherwise I'm gonna stab you." He also alleges Mair said "Britain first" or similar.

Another witness, Jack Foster, saw Mair shoot Mrs Cox and shout "Britain first" the court heard. Mr Foster then shouted "f****** leave her alone" but Mair shot the MP a second time, jurors were told.