A student who tweeted that anyone wearing a Help for Heroes T-shirt should be beheaded just hours after Lee Rigby was murdered has been spared jail.

Deyka Ayan Hassan, 21, posted the message on Twitter at around 4pm on Wednesday, May 22, shortly after the soldier was hacked to death in Woolwich, and was immediately inundated with rape and death threats.

Hassan went to police to report the threats against her, but was then herself arrested and charged with making a malicious communication. She pleaded guilty at an earlier hearing.

Katie Weiss, prosecuting, told Hendon Magistrates' Court on Friday that the tweet Hassan posted said: 'To be honest if you wear a Help for Heroes t-shirt you deserve to be beheaded'.

Itpal Dhillon, in mitigation, told the court that Hassan had posted the tweet as a "joke" and at the time was not aware Drummer Rigby was a soldier.

Ms Dhillon said: "At the time she didn't know the full details relating to the horrific incident.

"She certainly didn't know that the man who was killed was a soldier and the killing may be motivated by extremist beliefs or values.

"She fully accepts that the comment was distasteful and disgusting."

Ms Dhillon claimed Hassan had posted the message in relation to anyone who wore the T-shirt as she did not like its design.

She told the bench Hassan quickly shut down both her Twitter and Facebook accounts shortly after receiving replies to her tweet that said she "deserved to be raped" and threatening to set fire to her house.

She said that her client had always been brought up to be tolerant and respect society.

“She accepts that she deserves the response she got but it doesn't take away from the fact that she was being threatened,” said Ms Dhillon.

After realising the impact of her tweet Hassan was "disgusted" with herself and was particularly upset at having let down her family, including her father who flew back from Somalia after her arrest, the court heard.

Sentencing her to 250 hours of unpaid work, chairman of the bench Nigel Orton said: "By placing your tweet you published and that tweet caused great offence.

"The tragic events of Woolwich that day have created a context that made this tweet appear extreme.

"It had a huge impact and clearly caused offence and distress.

"We accept that you did not intend to cause harm and you felt it was a joke. Your act was naive and foolish and without regard to the sensitivity of the general public and a time of heightened sensitivity.'

Hassan, of Elmgrove Crescent, Harrow, admitted one count of sending a message that was grossly offensive or of an offensive or obscene character.