My question involves criminal law for the state of: Arkansas

I got snitched on by a stranger saying that I pulled out a knife and threatened him while I was walking past him, which I really didn't. The police then came and said that I was DETAINED. While I was detained (not arrested) the police conducted a pat down search on me and found marijuana in my pockets. Since I had already explained to the officer that it was a misunderstanding in that I was only going in my pockets to reach for my phone (the knife happened to be in the same pocket) and it was decided that I did not pull the knife on the stranger, the police then ARRESTED me for possession of marijuana. I would like to know: did the police have the legal right to do a pat down search on someone they are only detaining or do they only have the right to ask for identification of the person being detained??

Thanks