illegality
noun
°the state of being illegal.
"The criminal was aware of the illegality of his act."
°: a defense to the validity of a contract because it was in violation of the law.
"When sued for refusing to pay for services provided by a prostitute, the customer raised the defense of illegality."