Usually not a the border, no, because there it's an administrative thing, but then you are sent back to your originating country.
However, if arrested within the borders, yes, it becomes a different matter where you _are_ going through a judicial process, to assess whatever should happen, and why exactly (and to document the process).