A man who sent abusive and threatening tweets to Coldplay singer Chris Martin and TV presenter Rachel Riley has been given a restraining order preventing him from contacting the two celebrities.
Anthony Wells, of Chelmsford, Essex, admitted in court to harassing Riley, who presents the Channel Four quiz show Countdown and Channel 5's The Gadget Show, by sending abusive messages and death threats on Twitter.
The Crown Prosecution Service (CPS) said a second charge of similar harassment against Martin was not pursued following Wells's admission.
The CPS sentenced Wells to a hospital order under the Mental Health Act and issued a restraining order to protect the two stars.
Punam Malhan, the East of England Crown Prosecutor, said: "Everyone should be able to go about their daily lives free from harassment caused by someone deliberately making offensive, violent messages about them on social media.
"We take allegations of this kind very seriously and especially where there is evidence of a course of conduct which causes fear or distress to someone, regardless of whether a victim is in the public eye or not.
"Martin indicated that a plea to the charge involving Riley would be acceptable to ensure that Wells gets the medical help he needs. He was content for us to not to proceed in relation to the remaining charge."