They detain you to prevent you from destroying or hiding evidence or that they feel you may flee knowing you are “busted”.
Again, I’d see what the lawyer has to tell them.