Mohammed Ahmed was jailed for five months and placed on the sex offenders' register for five years.