Committed voluntarily and purposely, with the specific intent to do something; voluntarily and intentionally assisting or advising another to do something that the person knows disobeys or disregards the law. A person does not act "willfully" if the person acts as a result of a good faith misunderstanding of the requirements of the law.
Intent and motive should not be confused. Motive is what prompts a person to act, while intent refers to the state of mind with which the act is done.
So, if the acts constituting a crime were committed by someone voluntarily as an intentional violation of a known legal duty, that is, with specific intent to do something the law forbids, then the element of "willfulness" has been satisfied even though the person may have believed that his conduct was [religiously, politically or morally] required, or that ultimate good would result from such conduct.
On the other hand, if there's a reasonable doubt as to whether someone acted in good faith, sincerely believing himself to be exempt by the law [e.g. from the withholding of income taxes], then he did not intentionally violate a known legal duty, that is, he did not act "willfully".