It's the ultimate separation of powers.
The moment we acknowledge that the right of citizens to self-defend, to defend mutually, and to unite to throw off tyranny is a God-given, unalienable right, the power of both foreign and local governments, and of all organized and unorganized hostiles becomes limited and manageable.
It's in the Second Amendment itself:
"A well regulated Militia, being necessary to the security of a free
State, the right of the people to keep and bear Arms, shall not be
infringed."
"The security of a free state" implies the need for security at all levels, including (a) the security of private citizens and families in their homes and in society, (b) the security of neighborhoods, schools, municipalities, and counties, (c) the security of free states (as in Colorado, Texas, etc.), and (d) the security of the United States of America from abuses in central and local leadership as well as from all other criminal and foreign powers of any sort or origin.
The Founders recognized the need for checks and balances in government to limit the concentration of power, and that corruptible persons are not to be trusted with too much of it. Power is diffused to the maximum extent possible by acknowledging the right of all citizens to self-protect. This is the very notion that is baked into the Second Amendment. You will note that it does not say, "The right of the Government to keep and bear arms shall not be infringed", but "of the people". This is entirely consistent with the 9th and 10th Amendments, which expressly limit governmental powers, ascribing all freedoms as duly had by the citizens themselves, and to government only as enumerated.
It's also in the Oath of Citizenship, which applies to all U.S. citizens and is the legally binding contract upon which citizenship is predicated:
"I will support and defend the Constitution and laws of the United
States of America against all enemies, foreign and domestic; [...] I
will bear arms on behalf of the United States when required by the
law"
https://www.uscis.gov/us-citizenship/naturalization-test/naturalization-oath-allegiance-united-states-america
It's also defined in U.S. Federal code:
"The militia of the United States consists of all able-bodied males ... at least 17 years of age and ... under 45 years of age"
https://www.law.cornell.edu/uscode/text/10/246
From these sources it becomes clear that there is no limitation on the national origin, etc. of an enemy of the United States or of a security threat. The oath of citizenship consists of a binding covenant and agreement for the citizens to protect each other mutually from all invaders, which can also be gleaned as the most prominent objective and benefit of Union according to the Federalist Papers. The individual, uninfringeable right to adequate arms and organization is an indispensable key to national security.
Only by shackling or obscuring this right would it be possible for anyone to amass power against the will of the people.