There are multiple definitions - click on the translation that matches your context.

违法

名词

full

illegality

noun

Definitions of illegality

English

the fact that something is illegal (=not allowed by the law)

I know from my own experience that the illegality surrounding heroin misuse only makes the problem worse.