Can a police officer stop me for no reason?

Last week I was riding my motorcycle down clifton, there was a police officer sitting at the corner checking for stickers and any other faulty equipment. Me and my other two friends (also on bikes) road bye and he stopped us and ask for our licenses. My friend didn't have a class m license and he wrote him a... show more Last week I was riding my motorcycle down clifton, there was a police officer sitting at the corner checking for stickers and any other faulty equipment. Me and my other two friends (also on bikes) road bye and he stopped us and ask for our licenses. My friend didn't have a class m license and he wrote him a ticket. I was wondering if he had a right to stop us and request for our id's. Even though we had no probably cause to be pulled over in the first place (ie; dead tags or inspections or lack of safety equipment) could we have refused to show him our id's and got away without him running all our info (even the ones who have class M licenses) for 30 minutes?
Update: Please answer the question. The question is "could we have refused to show proof if he had no probable cause". Thanks for all your help.
Update 2: Thanks for all your answers!
12 answers 12