They cannot search your vehicle or your persons without reasonable cause. Now, by "detaining" do you mean they put you in handcuffs and put you in the back of the car? Did you get read your Miranda rights? Did they say WHY they were searching you or your vehicle? Did you give them permission? Did they say when the law went into affect about the light on your license plate? If it was a MO statute or local law? You may have a case if you find the right lawyer.
Small town police are so much fun.
I love being a legal student.