Swansea magistrates said Robert Riley's online messages were also racially and religiously aggravated and that only a custodial sentence could be imposed.
Riley, from Port Talbot, was sentenced to eight weeks in custody after admitting posting an abusive Twitter message about the death of Leeds schoolteacher Ann Maguire.
The 42-year-old was the second person to be charged with the offence in the wake of the death of Mrs Maguire, who was stabbed to death in her classroom at Corpus Christi Catholic College last month.
Yesterday a third person was arrested in Cardiff and bailed.
More top news
Gareth Bale put any domestic troubles behind him as he starred in Wales' emphatic 3-0 win over Israel in Haifa.
National Trust Wales has announced it's to open the new Far End Garden at the end of this month, spanning 80 acres of Snowdonian hillside.
Cardiff's tourism information centre is closing today, with the only staffed provision residing in Cardiff Bay.