So, the department of Defense cannot defend????
You can read up on on this law, but no the military can not use police powers within the country without first taking steps. I suppose this is to keep from having a military state. The Guard can be used for certain reasons. But, I believe for day-to-day purposes, they would use Border Patrol, ICE (DHS), DEA, etc.
The DOD - our Military - defends on a daily, regular basis against threats off of our soil. I suppose in an act of war on our soil, they would be called on as well. But, as bad as this is, we are not at war with Mexico or any other nation.