Its a weird grey area for sure. The best rationalization I have ever come up with is that when speech involves a legitimate threat to do harm, for example, that skips past just speech and can be seen as a step in actively planning to do harm. In certain situations, like murder or terrorism, we've agreed that simply planning to do it is a crime.
Combine the two and it isn't that you said something that is illegal, its that the statement is interpreted as a clear signal of actively planning to do something which itself is illegal.