A 15-year-old was held in a police station for six nights because there were no beds at any Oranga Tamariki facility in the country.
The Nelson boy's lawyer says he is lodging a complaint with the Children's Commissioner over the incident, and said holding youths in cells should be made illegal.
The teenager, who was arrested last Wednesday and charged with burglary, was declined bail at a hearing the next day.
"It was intended that he go to Oranga Tamariki [Ministry for Children] custody," lawyer John Sandston said.
But, when no bed could be found, the boy was sent back to the cells for another night.
On Friday, Mr Sandston said he applied to have the boy moved to a local marae.
"[They] were going to supervise him for the better part of the week, provide him with all sorts of activities and there would be an overnight curfew at his home seven days a week," he said.
However, the application was declined by a judge because the boy had a long history of running away and reoffending.
"He put him off until Monday of this week to check whether beds were available, because his intention was to put him in the custody of Oranga Tamariki," said Mr Sandston.
"[He] was told yesterday, no beds [were] available nationally, but that Oranga Tamariki were looking at a Dunedin home as it was termed as an alternative to a residence."
But this morning the situation had not improved.
"No beds [were] available nationally again and the Dunedin family home that has connections with Oranga Tamariki was not able to help either," Mr Sandston said.
The decision to hold the boy at a police station for so long could have lasting traumatic effects, he said.
"The psychological dangers can't be underrated for a kid with his vulnerabilities and his personality traits."
He was concerned the boy had been isolated, which could have led to depression.
"He was the only person of that age I understand would've been in the police station," Mr Sandston said.
"They're not equipped in any way, shape or form to look after a young person."
The boy was granted bail today after the court ruled it was untenable to hold him any longer.
The situation was not a one-off occurence, Mr Sandston said.
"This has been going on for decades," he said.
"It occasionally comes up in parliament, occasionally comes up in the media and then it all dies away until someone highlights it again."