A self-proclaimed survivalist and "patriot" amassed an arsenal of crossbows, arrows and knives in order to prevent an extremist attack similar to that which claimed the life of Lee Rigby, a court heard.

Roger Smith, 46, said he stockpiled the weapons at his home because of "all the Isis shit" and believed he was preparing for a war, a jury at Nottingham Crown Court was told.

Smith, of Summerwood Lane, Clifton, Nottingham, is standing trial accused of possessing 2.16 kilograms (4.76lbs) of low explosive black gunpowder, as well as having 11 explosive substances, including hydrochloric acid on October 21 last year.

He is further accused of two counts of possessing a copy of the Anarchy Cookbook Version 2000, which "has information likely to be useful to a person committing or preparing acts of terrorism".

Opening the case for the prosecution, Michelle Heeley said Smith felt he was being treated "like I am a Muslim" when his address was searched after he told officers he had gunpowder.

She said: "Smith told the police officers on the way to the station that he had got things in his house to defend 'us' against the Muslims.

"Smith was saying that he was disgusted that he was being treated like a terrorist and a Muslim, when in fact the police should be thanking him since they would be fighting side by side when the Muslims came to attack.

"Smith kept saying that he was a patriot."

The prosecutor said of the exhibits found at his home: "It is right that he had not sought to hide any of these items from the police, indeed you may think he seemed quite proud of them."

She added Smith was intending to fly an Israeli and Knights Templar flags outside of his address along with a St George's Cross, "as they were part of his heritage and he was a patriot".

Following his arrest, Smith told officers he held the chemicals for "legitimate purposes" and that he used the gunpowder to get his nieces and nephews interested in science.

The court heard Smith used the Anarchy Cookbook to help him make gunpowder, and while he was on bail on the explosives charges purchased another copy from Amazon.

Ms Heeley said: "He had wanted to make the point that since you could buy in from Amazon, it must be OK to have it in this country."

Referring to Smith's police interview, Ms Heeley said: "He said that Isis was a threat to the entire Western civilisation, and that if there was another Lee Rigby style attack he would be the sort of person who would help to stop it."

Concluding her opening speech to the jury, she said: "The prosecution say that is not merely an enthusiastic amateur scientist, he has it in his mind that he is going to defend his country from an attack by Isis, and he has gathered his weapons, got his patriotic flags ready, and made explosives at home in order to do that."

Smith denies all the charges.