Now, officially the shengen zone means there's no need to show your documents between countries. But countries still don't want certain people coming in. And they don't want drugs smuggled in either.
It was really interesting who they decided to pull aside for a chat. It was almost always men who were travelling alone. Almost always men who were in the 25-45 age range. And I wouldn't be surprised if there was some racial profiling going on as well. The police never questioned me - probably because I was with my girlfriend the whole time. If she wasn't there, I bet I would have been pulled aside every time too.
Anyway, I believe your experience in Europe. But if you were a man travelling alone, its possible it was partially or fully due to that. For about a decade, every time I went through security at an airport I was always "randomly selected" to have my bag swabbed for chemicals. It never happens any more, and I'm as white as they come. I assume it was a gender + age + travelling alone thing - but its still a mystery to me.