A former security guard at Crossrail who threatened a shopkeeper for selling the Charlie Hebdo magazine has been jailed for trying to join Islamic State in Syria.

Extremist Shamim Ahmed, 24, was stopped at the Syrian border in Turkey and returned to Britain in January last year.

The Bangladeshi national, of Tower Hamlets, east London, was found to have a stash of extremist material on his mobile phone and had being using social media to research ways to enter Syria and join the terror group.

Ahmed pleaded guilty to preparation of terrorist acts and was sentenced at the Old Bailey to six years in prison with an additional year on licence.

Previously, Ahmed had admitted threatening to damage a bookshop if it sold copies of Charlie Hebdo shortly after a terror attack at the magazine’s offices.

In November 2015 he pleaded guilty to two counts of malicious communications and was sentenced to 20 weeks imprisonment, suspended for two years, at London’s Hammersmith Magistrates Court.

The year before, he had sent an email to the office of the Prime Minister threatening to wage jihad and slaughter against Israel and its allies, saying: “We are coming for you soon for revenge. Just wait and watch.”

The following month, he got a job with a security firm on a zero hours contract and was sent to the Crossrail project which passes a number of sensitive locations.

Sue Hemming, of the Crown Prosecution Service, said: “People thinking of travelling to Syria to engage in violence can expect to be returned to the UK to face prosecution and a potential prison sentence, with all that means for them and their loved ones.

“Shamim Ahmed had little choice but to plead guilty when faced with the weight of evidence presented by the prosecution.

“Thanks to our work with the police and Turkish authorities, Ahmed’s plan to join IS has been thwarted and he will no longer pose a threat to the public in the UK or abroad.”