Posse Comitatus cannot apply to the militia, as it is the militia that has the constitutional charge to repel invasions. The militia is the only institution with this mission.
The problem is, we are Americans and don’t read.
We don’t have militias. We have a standing military.
The military does not have law enforcement authority, by design and for good reasons.