Surely there was a reason. You just may not know what it was.
At this point you were probably just being detained, but so far everything seems fine.
He didn't have to, though this typically should have become clear at some point later.
If you feel their personal conduct was unprofessional...