The phrase "the people" is a term of art used in select parts of the Constitution. This term "the people" refers to a class of persons who are part of a national community or who have otherwise developed sufficient connection with this country to be considered part of that community.
As I like to point out, The Constitution begins with the phrase "We the people", but did the entire population take part in the drafting of the document,or was it the representatives of the people who did that task?
In the Heller-McDonald decisions, the majority opinion interprets the Second Amendment to protect a “subset” significantly narrower than the class of persons protected by the First and Fourth Amendments to “law-abiding, responsible citizens.” But the class of persons protected by the First and Fourth Amendments is not limited because felons (and presumably irresponsible citizens as well) may invoke the protections of those constitutional provisions.
The Heller-McDonald decisions neglect the manner that the Framers used the phrase “the people” in these constitutional provisions. In the First Amendment, no words define the class of individuals entitled to speak, to publish, or to worship. It grants the right peaceably to assemble, and to petition the Government for a redress of grievances, that is described as a right of “the people.” These rights contemplate collective action. While the right peaceably to assemble protects the individual rights of those persons participating in the assembly, its concern is with action engaged in by members of a group rather than any single individual. Likewise, although the act of petitioning the Government is a right that can be exercised by individuals, it is primarily collective in nature. For if they are to be effective, petitions must involve groups of individuals acting in concert.
As used in the Fourth Amendment, the term “the people” describes the class of persons protected from unreasonable searches and seizures by Government officials. It is true that the Fourth Amendment describes a right that need not be exercised in any collective sense. But that observation does not settle the meaning of the phrase “the people” when used in the Second Amendment . For, as we have seen, the phrase means something quite different in the Petition and Assembly Clauses of the First Amendment . Although the abstract definition of the phrase “the people” could carry the same meaning in the Second Amendment as in the Fourth Amendment , the preamble of the Second Amendment suggests that the uses of the phrase in the First and Second Amendments are the same in referring to a collective activity. By way of contrast, the Fourth Amendment describes a right against governmental interference rather than an affirmative right to engage in protected conduct, and so refers to a right to protect a purely individual interest. As used in the Second Amendment, the words “the people” do not enlarge the right to keep and bear arms to encompass use or ownership of weapons outside the context of service in a well-regulated militia.
There is also the rule of Statutory interpretation called Ejusdem generis ("of the same kinds, class, or nature") which is when there is a more specific descriptor is followed by more general descriptors, the otherwise wide meaning of the general descriptors must be restricted to the same class, if any, of the specific words that precede them. For example, where "cars, motor bikes, motor powered vehicles" are mentioned, the word "vehicles" would be interpreted in a limited sense (therefore vehicles cannot be interpreted as including airplanes).
The Latin words ejusdem generis (of the same kind or nature), have been attached to a canon of construction whereby wide words associated in the text with more limited words are taken to be restricted by implication to matters of the same limited character.
Thus, the general term "people" in the Second Amendment is limited by the restrictive "well-regulated militia" in the text.
Thus, the words “the people” in the Second Amendment refer back to the object announced in the Amendment’s preamble. They remind us that it is the collective action of individuals having a duty to serve in the militia that the text directly protects and, perhaps more importantly, that the ultimate purpose of the Amendment was to protect the States’ share of the divided sovereignty created by the Constitution.