That clause simply provides one important reason why "the right of the people to keep and bear Arms shall not be infringed". It's not a limitation or restriction on that right. For more an extensive deep-dive on the meaning of this amendment, see District of Columbia v. Heller, 554 U.S. 570 (2008): https://supreme.justia.com/cases/federal/us/554/570/#tab-opi...
> ... the Second Amendment’s prefatory clause announces the purpose for which the right was codified: to prevent elimination of the militia. The prefatory clause does not suggest that preserving the militia was the only reason Americans valued the ancient right; most undoubtedly thought it even more important for self-defense and hunting. But the threat that the new Federal Government would destroy the citizens’ militia by taking away their arms was the reason that right—unlike some other English rights—was codified in a written Constitution. ...
> Besides ignoring the historical reality that the Second Amendment was not intended to lay down a “novel principl[e]” but rather codified a right “inherited from our English ancestors,” Robertson v. Baldwin, 165 U. S. 275, 281 (1897), petitioners’ interpretation does not even achieve the narrower purpose that prompted codification of the right. If, as they believe, the Second Amendment right is no more than the right to keep and use weapons as a member of an organized militia — if, that is, the organized militia is the sole institutional beneficiary of the Second Amendment’s guarantee — it does not assure the existence of a “citizens’ militia” as a safeguard against tyranny ...
> Every late-19th-century legal scholar that we have read interpreted the Second Amendment to secure an individual right unconnected with militia service. The most famous was the judge and professor Thomas Cooley, who wrote a massively popular 1868 Treatise on Constitutional Limitations. Concerning the Second Amendment it said: (...)
> “It might be supposed from the phraseology of this provision that the right to keep and bear arms was only guaranteed to the militia; but this would be an interpretation not warranted by the intent. The militia, as has been elsewhere explained, consists of those persons who, under the law, are liable to the performance of military duty, and are officered and enrolled for service when called upon. (...) The meaning of the provision undoubtedly is, that the people, from whom the militia must be taken, shall have the right to keep and bear arms; and they need no permission or regulation of law for the purpose. But this enables government to have a well-regulated militia; for to bear arms implies something more than the mere keeping; it implies the learning to handle and use them in a way that makes those who keep them ready for their efficient use; in other words, it implies the right to meet for voluntary discipline in arms, observing in doing so the laws of public order.”
> ... the Second Amendment’s prefatory clause announces the purpose for which the right was codified: to prevent elimination of the militia. The prefatory clause does not suggest that preserving the militia was the only reason Americans valued the ancient right; most undoubtedly thought it even more important for self-defense and hunting. But the threat that the new Federal Government would destroy the citizens’ militia by taking away their arms was the reason that right—unlike some other English rights—was codified in a written Constitution. ...
> Besides ignoring the historical reality that the Second Amendment was not intended to lay down a “novel principl[e]” but rather codified a right “inherited from our English ancestors,” Robertson v. Baldwin, 165 U. S. 275, 281 (1897), petitioners’ interpretation does not even achieve the narrower purpose that prompted codification of the right. If, as they believe, the Second Amendment right is no more than the right to keep and use weapons as a member of an organized militia — if, that is, the organized militia is the sole institutional beneficiary of the Second Amendment’s guarantee — it does not assure the existence of a “citizens’ militia” as a safeguard against tyranny ...
> Every late-19th-century legal scholar that we have read interpreted the Second Amendment to secure an individual right unconnected with militia service. The most famous was the judge and professor Thomas Cooley, who wrote a massively popular 1868 Treatise on Constitutional Limitations. Concerning the Second Amendment it said: (...)
> “It might be supposed from the phraseology of this provision that the right to keep and bear arms was only guaranteed to the militia; but this would be an interpretation not warranted by the intent. The militia, as has been elsewhere explained, consists of those persons who, under the law, are liable to the performance of military duty, and are officered and enrolled for service when called upon. (...) The meaning of the provision undoubtedly is, that the people, from whom the militia must be taken, shall have the right to keep and bear arms; and they need no permission or regulation of law for the purpose. But this enables government to have a well-regulated militia; for to bear arms implies something more than the mere keeping; it implies the learning to handle and use them in a way that makes those who keep them ready for their efficient use; in other words, it implies the right to meet for voluntary discipline in arms, observing in doing so the laws of public order.”