I maintain that simply being at a border crossing should not be grounds for detaining, but I do recognise that while a competent border crossing would make it impossible for someone to simply walk into the sterile "crossing zone" (and in airports such zones are usually pretty solid), this is not exactly a department known for competency.
Edit: Now that I consider it, it would seem really incompetent to just not notice which direction someone came from. This would allow people to cross the border all day with impunity. Pure speculation, but I bet they knew exactly which way he came from; they just felt like hassling some muslim looking guy without ID because they could (although I recognise that in the US, carrying a driving license everywhere seems to be a weird cultural phenomenon).