Pretty much any country does this. Unless you're a citizen of that country, you have no right to enter it and should be on your best behavior at all times, and they can decline you for any reason they feel like, justified or not.
I've been all across the world. I've been turned away from Canada twice (every occasion) over some weed 15 years ago. No other country cares unless you are applying for a long term visa or something. I even tried applying for the right to visit and was turned down (again, over weed).