The young man was in a prison T-shirt and is being held in Whanganui prison in the at-risk unit.
Stillwell said he phoned health board on Monday to ask if they had a plan in place, but they did not.
The only plan was for Stillwell to follow up.
He said since then, the man has been held in custody and the prison guards had been doing a great job - as were police - but the agencies responsible have ignored his emails, Stillwill said.
Stillwell said he also made the providers aware that there was media interest, in a bid to highlight the "absolutely outrageous nature" of the situation.
"It was just crazy," he said.
Judge Lynch agreed.
"We have a young man in jail because services aren't stepping up to the plate," he said.
Using the criminal justice system was not appropriate for a young man who has serious challenges, and would be unlikely to be fit to plea.
Judge Lynch said he could not keep the man in jail.
He needed somewhere to go and it could not be in the criminal justice system, he said.
He said the only option may be to put the man into a hospital, and he might very well do that this afternoon.
The case will be recalled later today, in the hope that a resolution could be found.