Graham Power, assistant HM Inspector of Constabulary, told The TES Scotland this week that police should not detain children without "a vigorous exploration of the alternatives".
The Inspectorate of Constabulary warned Lothian and Borders Police last month that a shortage of secure accommodation should not be used as "an inappropriate reason for detaining children in police custody".
Mr Power acknowledged that the Lothian and Borders force itself felt it was being forced into an undesirable practice. "It is a concern we share."
The problem is particularly acute in Edinburgh because children are currently detained in a station where they share a corridor with adult offenders.
Across Scotland children under the age of 16 are detained in police custody about 500 times a year. Strathclyde, the largest force, is responsible for about 300 detentions. The figure in Lothian and Borders is around 50.
Persistent male offenders in their early teens are most likely to be involved.
Tom Wood, deputy chief constable of Lothian and Borders, says such offenders are often responsible for "one-man crime waves" and because of a national shortage of secure accommodation detention was the only option.
Before a child can be held in custody certain criteria must apply. There has to have been a serious crime, with the child deemed likely to harm himself or others if released. An emergency social work team has be contacted and secure accommodation sought. Only where this is not available can a child be kept overnight in a detention room, until an emergency meeting of a children's panel is convened.
There are 86 secure accommodation places in Scotland. A spokesman for the Executive's department of children and education said: "While it is recognised demand for these places is high and that there are difficulties experienced by fluctuations in demand, there are no requirements to increase places."
However, a "modest expansion" is under way. Plans are in place for six more beds at St Mary's Kenmure in Glasgow while Dundee is set to provide four places once a new children's home has been completed.
The Executive is conducting an analysis of arrangements for secure care to determine why children are there, and aims to phase out the use of police cells.