That's a bid mind boggling for me. Let's say we have a contract. You break it. So I'm not happy, I suppose I take you to the court.
And there, something is enforced that is not the law but where you are lawfully obliged to a sanction afterwards ?
I don't really understand why you'd say that ? Isn't the law kind of saying "you shall not break contracts" ? And if it's not, what's the point of a contract ?
My comment was typed quickly and was pretty non-specific, so I'm sorry about that and I probably deserved the downvotes. However, I maintain that under most people's understanding of the terms "breaking a contract" and "illegal", breaking a contract is not illegal.
Regarding "breaking a contract": Contracts often stipulate penalties for non-performance of terms within them. For example, you contract with me to rent my house for 5 years. The contract stipulates that if you leave early, I am entitled to keep the deposit. In common language, people will refer to leaving early as "breaking the contract", but there is nothing illegal about doing so.
Regarding "illegal": If the contract does not specify some penalty for non-performance of a clause, or it does specify one but you somehow avoid the penalty, then it would become a matter for the courts, but importantly, it would be a civil court, not a criminal court. You have not broken a law, you have broken a contract, and the civil courts will determine how this situation will be made right.
Breaking a contract is typically not breaking the law.