Before going any further, I assure you that this is not an attempt to take away anyone’s gun. This is not an attack upon “gun rights.” The Second Amendment (to the Constitution of the United States of America) has nothing to do with owning guns.
For source documents and references, I will refer you to the Constitution including the Bill of Rights, and the Declaration of Independence.
The colonists were British citizens. National defense within the British colonial empire relied upon a relatively small standing army and a large number of local militias. British male adult colonists expected to participate in the colonial militia. It was not lost upon anyone that this distribution of power acted as a check upon the monarchy. If the king were to use the military force of the standing army, that force would be countered by the local militia. The English Bill of Rights (1689) prohibited the king from disarming the militia.
The North American colonists were treated intolerably by the British monarchy; see their list of grievances in the Declaration of Independence (1776). A war later they established their own system of government; see the Constitution (1787). The Constitution created a new Federal government. The Constitution implemented a defense arrangement similar to the British model the colonists had known for generations. (See Article 1, Section 8, Clauses 15 and 16.) Each former colony, now to be referred to as a State, would retain its Militia. There would be a small army (and a large navy) at the disposal of the new Federal government. Note, incidentally, “The Congress shall have Power … To raise and support Armies, but no Appropriation of Money to that Use shall be for a longer Term than two Years”. Contemporary national defense does not reflect what the Constitution implemented.
Having just had one government turn on them, there was reluctance amongst some colonists to put trust in a new government. Anti-Federalists agreed to ratify the Constitution as long the first Congress developed limits upon the powers of the new Federal government. The first Congress produced the (American) Bill of Rights (1789) to further limit the powers of the new Federal government, just as the English Bill of Rights had limited the powers of the British monarchy.
That is how we came to have the Second Amendment. “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 former colonists would have recognized what this law was saying. The new Federal government would not be permitted to interfere with the militia of a former colony.
We don’t do national defense that way anymore. Instead, we have a large standing army and we have done away with militias. With no Militias to infringe, the Second Amendment has no scope. This should not be a shocking conclusion; the Third Amendment (prohibiting the lodging of soldiers in civilian homes without the consent of the civilians) is likewise anachronistic.
The Second Amendment has nothing to do with owning guns. The Second Amendment did not create a right to own guns. In fact, rights cannot be created or revoked by any law. Rights either exist or they don’t. Rights can be used to justify laws. In the case of the Second Amendment, the right to keep and bear arms is used to justify the law protecting a well regulated Militia. The law, however, pertains to a well regulated Militia. The law is not about owning guns.