A 13-year-old was held in police cells overnight before being transferred to court where hours later the charges were withdrawn.
RNZ understands the boy was held in court cells with violent offenders until about midday today.
By then police had withdrawn the charges but the boy was still in the court cells.
It was not until lawyers stepped in and asked for the case to be called before a Community Magistrate that the boy was released from custody.
The boy had been charged with endangering transport - a charge that carries a maximum term of 14 years in prison.
Under the Oranga Tamariki Act, police can only hold a 12 or 13-year-old if they are charged with an offence that carries a maximum penalty of at least 14 years.
A lawyer spoken to by RNZ said the alleged offending would normally attract a charge of dangerous or reckless driving.
A spokesperson for the police said the boy was driving a stolen car, failed to stop for the police and that his driving was extremely dangerous.
She said he was driving on the wrong side of the road and on footpaths.
The spokesperson said after the boy spent the night in police cells, police decided to deal with the matter through the care and protection provisions of the Oranga Tamariki Act.
RNZ asked police what that meant but they were yet to respond.
The matter is now before the Family Court.