The fact that you had prior convictions does not allow the police to search your car without your consent. I'm not even sure you even have to identify yourself since you haven't done anything illegal or that would support a "detention" much less an "arrest."
You can "fight" the new possession charge because under the Fourth Amendment you have the constitutional right to be free of unreasonable searches and seizures. If the search is no good, then the evidence discovered, i.e., the mj must be suppresed and you should be free to go. Unfortunately, very often the police will search first and think of a reason afterwards to justify the intrusion.
You must file a separate "motion to suppress" under the Fourth Amendment that pertains to "reasonable" searches and seizures.
I hope this information is helpful to you.