Hire a defense attorney to help you. Sadly, as the saying goes, "ignorance of the law is  no defense," so that fact that you did not know this illegal will not help you. But if you have a clean regard, express contrition, did not  resist arrest, are young, etc.--i.e, all the things you write about--you may be able to have the charge dismissed, or at least reduced to a lesser charge. Experienced defense counsel will be able to highlight all the factors in your favor and will have the best chance of coming to a good outcome.