A man has been jailed for 12 weeks for making grossly offensive comments on his Facebook page about missing youngster April Jones.
Matthew Woods, 19, from Chorley, Lancashire, made a number of derogatory posts about April and missing Madeline McCann after getting the idea from Sickipedia - a website that "trades in sick jokes".
He also wrote comments of a sexually explicit nature about the five-year-old who went missing last week from near her home in Machynlleth, mid Wales.
Chorley Magistrates' Court heard members of the public were so upset about his postings that they reported them to the police.
A "vigilante mob" of around 50 people later descended upon his home address in Eaves Lane and the defendant was arrested on Saturday night at a separate address for his own safety.
Martina Jay, prosecuting, said: "When interviewed by police he fully admitted he posted messages about the two missing children.
"He started this idea when he was at a friend's house when drinking, saw a joke on Sickipedia and changed it slightly.
"He said he did it in a bid to make people think his account had been hacked. He said it got out of hand and he was drunk while doing it."
He conceded to police that his Facebook account - available to a large number of people - had not been hacked and that he was responsible for all the postings made on October 3 and 4.
Unemployed Woods entered a guilty plea to sending by means of a public electronic communications network a message or other matter that is grossly offensive.
After meeting his client for the first time, defending solicitor David Edwards told the bench: "What struck me immediately is that the enormity of what he has done has finally sunk in.
"He did seem genuinely remorseful and regretful for what he had done."
The solicitor said Woods explained what had started as a joke had gone wrong.
"His future is uncertain. He does not know whether he can go back to his home address. He fully accepts he was the author of his own misfortune," Mr Edwards added.
He asked for a community service order to be considered but the bench was told that custody could be imposed for anyone who is convicted of using extreme language that causes substantial distress or fear to another.
The bench asked for a pre-sentence report from a probation officer and said it would keep all options open ahead of sentencing, which will take place later.