Can my school search me?

Question Details: My second period class was over and I went to the bathroom before my next class. The bathroom smelt like weed when I got in there and when I left the assistant principal saw me. He then pulled me out of class a couple of minutes later even though he didn't see me smoking or anything in the bathroom, which I wasn't anyway. I was searched by one of the school's administration workers but I asked them before they searched me how they where allowed to do that and they said the smell of weed gave them suspicion to search my backpack. However, I didn't smell like weed at all and neither did my backpack; it was just the bathroom. So I'm just confused on how they were allowed to search me. I just want to know if I could fight it in court and have a chance of winning. This will be my second MIP and I don't think it was fair how I was searched. I looked up state laws for searching students and it said that they aren't allowed to search over a hunch and that's what I feel like they did.

IMPORTANT NOTICE: The Answer(s) provided above are for general information only. The attorney providing the answer was not serving as the attorney for the person submitting the question or in any attorney-client relationship with such person. Laws may vary from state to state, and sometimes change. Tiny variations in the facts, or a fact not set forth in a question, often can change a legal outcome or an attorney's conclusion. Although has verified the attorney was admitted to practice law in at least one jurisdiction, he or she may not be authorized to practice law in the jurisdiction referred to in the question, nor is he or she necessarily experienced in the area of the law involved. Unlike the information in the Answer(s) above, upon which you should NOT rely, for personal advice you can rely upon we suggest you go to and retain an attorney to represent you.