Perhaps a good intuition pump is how we react when this breaks down. If some group within a state's borders is using violence (i.e. sending soldiers to attack skyscrapers in another country), the attacked country has a cassus belli against the harboring country.
This feature is so critical to how the modern system treats territorial integrity that we sometimes refer to states which can't control violent groups within their own borders as "failed states."
Was this example really necessary? You basically said: If terrorists (who, by the way, happened to travel to Afghanistan once) attacked the WTC, the US have a casus belli against Afghanistan.
See, the reason why the war in Afghanistan is controversial is precisely because it is not clear that a country has a casus belli against another country if there is a (remote) connection of offenders to that country. In fact, the pilots lived and planned most of the plot in Germany.
A better example of a failed state would be the results of the war on drugs in Mexico.
This feature is so critical to how the modern system treats territorial integrity that we sometimes refer to states which can't control violent groups within their own borders as "failed states."