It is a terrible ordeal, but for all of the other factors brought up the critical factor is that he set off an explosion detector (and clearly it doesn't get false positives often given the response they showed). Everything else (about Ramadan, being Hindi, the color of one's skin, etc) may be nothing more than decorations, and no one here knows what would happen if John Smith Anglosaxon set off the same detector in…
The tests they use are intentionally cheap and fast. Accuracy is not the primary criteria.
For white people you get an extra 30 second pat down. For brown people you get detained and interrogated all day.
Like drug dogs, false positives may be considered a bonus by the security apparatus because it allows the apparatus to work against the discriminated-against class and blame it on something else, as you have just done.