The fact that an offender is ignorant of the law is not an excuse for any offence committed by him, but it may be relevant to the question whether or not an act or omission which would constitute an offence if accompanied by a certain intention or state of mind was in fact accompanied by that intention or state of mind.