Justified search of my privacy by police??

I wanted to ask if it was a justified search when me and my colleague were sitting in front of a skate park. We did nothing, just talked. We were asked by plainclothes police officers: ID check, fair, but then search of our jacket pockets based on quote: "You were sitting in the dark in front of a skate park" That is never a "justified" search. Great, we were sitting on a normal bench in the dark, what is the reason for the search? How can I defend myself? Was it justified after all? And they treated us like we re criminals too, pretty aggressive. Someone let me know please, would really love to hear someone elses opinion.