To detain a person means to prevent them from leaving a particular place, usually by a person in authority such as the police, for reasons such as suspicion of involvement in a crime or for questioning. Full definition
Based on the above, preclearance officers may also detain people for strip searches, but only CBSA officers can perform them. (advisor.ca)
The provision allows for enhanced credit if the circumstances allow it «unless the reason for detaining the person in custody was stated in the record.» (canadianlawyermag.com)
In fourth place is an anonymous account from a guard in an immigration detention centre who explained why working in a system which detains people who have never committed a crime, keeps him up at night. (politics.co.uk)