The law does not refer to “terrorists” as the group to which it applies. It specifically references those fighting on behalf of named organizations such as al Qeada.
Does anyone seriously contend that the US military cannot defend Americans against terrorists if the attack is made on American soil? Really? Where is that found in the Constitution?
Not quite. It specifically references those declared by the government to be fighting on behalf of those organizations.
We have courts to decide if such declarations of guilt have any basis in fact.
The courts do not work on real battlefields during a firefight. But even the German saboteurs on US soil during WW2 got at least a military trial in fairly quick order.