1 The competent authority of the Confederation or the canton may detain persons who do not hold a short stay, residence or settlement permit:
a.
to notify them of a decision in connection with their residence status;
b.
to determine their identity or nationality, as far as their personal cooperation is required.
2 The person may be detained only for the duration of the required cooperation or questioning and the required transport if necessary, and for a maximum of three days.
3 If a person is detained, they must:
a.
be informed of the reason for their detention;
b.
be permitted to contact the persons guarding them if they require help.
4 If detention is expected last longer than 24 hours, the person concerned shall be given the opportunity beforehand to attend to or have someone else attend to urgent personal matters.
5 On request, the competent judicial authority must review the legality of the detention.
6 The duration of detention shall not be deducted from the duration of any detention pending deportation, in preparation for departure, or coercive detention.