A student who said on Twitter that people wearing Help for Heroes T-shirts "deserved to be beheaded" was arrested after complaining to police about threatening replies, a court has heard.
Deyka Ayan Hassan, from Harrow, sent the tweet in the aftermath of Drummer Lee Rigby's death in Woolwich, south-east London.
The 21-year-old student admitted sending a malicious electronic message.
She was ordered to complete 250 hours of unpaid work by Hendon magistrates.
Drummer Rigby was wearing the charity's T-shirt when he was attacked on 22 May.
Hassan, an English and politics undergraduate at Kingston University, said she had sent the tweet "as a joke" about the design of the T-shirt.
'Naive and foolish'
Some of the replies she received included threats to rape her and kill her by burning down her home, the court heard.
Chairman of the bench, Nigel Orton, told her she could have been jailed for the tweet but magistrates accepted she had not known it was a soldier who had been killed when she sent it.
"The tragic events in Woolwich that day have created a context which made this tweet appear extreme," he said.
"It had a huge impact and clearly caused offence and distress. We accept you didn't intend to cause harm and you felt it was a joke.
"Your act was naive and foolish and without regard to the general public at a time of heightened sensitivity."
The court heard Hassan's father works in Somalia for organisations including US Aid and Prevent which aim to combat extremism.
He is also a former "associate advisor for policing diversity" to the Metropolitan Police.