If you face a theft charge, ideally, you want to put forth a good defense that will end with a not guilty verdict by the court. If the prosecutor can prove you took the item in question, then your defense needs to be something that proves you had a reason to take the item that is not illegal.
FindLaw explains there are a few different defenses you may use that will prove you did not commit theft as the law defines.
Theft usually requires an intent to deprive the other person of the property indefinitely. If you returned it, then you may be able to claim that you never stole the item but borrowed it.
Sometimes, there may be blurred lines over the ownership of property. If this is the case, you may be able to use a claim of ownership over it to show you did not take it because it belongs to you.
You can also use this defense if it was a mistake. For example, if you took a bike that looked exactly like yours under the assumption it was your bike, then you could use the mistaken identity as a defense. You thought it was yours, so you took it. You had no intention of stealing anything.
Entrapment is a difficult defense. It applies in a situation where someone else sets you up to take something when you would otherwise not have done it. They enticed you in some way to commit the crime even though it goes against your normal actions.
Not every defense will work for every situation. You should also consult a legal professional to determine what works best for your circumstances.