Lewis Bruce, 22, who has a learning disability, thought he had been sending explicit messages to a 13-year-old girl on an adult internet dating site but had been snared by Dark Justice.
Dark Justice are a two man organisation who trawl the internet and trap men who are looking for underage sex.
Bruce, who is a vulnerable adult and has a disorder on the autism spectrum, turned up to meet who he thought was an underage schoolgirl but was
confronted by members of the anonymous organisation.
At Newcastle Crown Court, Bruce, of High Street East, Sunderland, admitted attempting to incite a child to engage in sexual activity.
The court heard Bruce, who had said he could "get into trouble" for what he was doing, had sent a text message to who he believed was the girl while he was on
the way to meet her in Newcastle city centre saying "I got condoms in case we have sex".
Judge Tim Gittins sentenced Bruce to an indefinite hospital order with a restriction which means the Secretary of State must authorise his release,
if and when medical experts deem him to be safe.
The judge told Bruce: "Very quickly you turned the conversation into sexual matters, including references to worrying and unpleasant sexual behaviour that you wanted to do to her.
"You went on to make plans to meet her, despite you clearly knowing her age and knowing that what you were doing was wrong, given the detail of the messages."
"What you planned to do and what you did was very serious, even though, fortunately, there was actually no young girl at risk."
The judge said Bruce would ordinarily have faced years behind bars but that his mental health difficulties meant a hospital order was appropriate in his case.
Judge Gittins told him: "I am clearly satisfied, having heard from doctors, that the best place for you and for the protection of the public, particularly young females, is within a medium secure hospital."
The judge said Bruce poses a risk of harm to the public at the moment.
Bruce must abide by a Sexual Harm Prevention Order and sign the Sex Offenders Register for life.
Jamie Adams, defending, said Bruce is a vulnerable adult whose home has come under attack as a result of his offending.
He will receive ongoing treatment in hospital to deal with his conditions and reduce the risk he poses to the public.