"The people" refers to the militia. Back then, everyone was part of a militia.
Then I suppose "the people" in amendments I, IV, and X also refer to the militia? Of course not. You are correct in pointing out that back then the people were considered the militia, but "the people" still means "the people". The first part of the Second Amendment is explanatory of at least one reason why the right of the people to keep and bear arms should not be infringed, but it is not the part of the amendment that states the law itself. It's a justification for the amendment, nothing more and nothing less. If the Second Amendment was rewritten to be compliant with modern vernacular, it would be something like this:
"The right of the people to keep and bear arms shall not be infringed because a well regulated militia is necessary to the security of a free state."
Militias were very informal during the time the amendment was implemented - they weren't actually regulated by the government, rather they were just local groups ready to fight when an emergency came up. By protecting the right of individual people to keep and bear arms, civilians could (and still can) form militias when necessary, among other things.
John,
You are essentially correct, but the definition of militia is conterminous with those eligible to cast a vote in a state election (i.e. at this point, adult citizens who have not been convicted of an ad hominem felony or treason, and who have not been found mentally incompetent by a court of law).
As such, it is both a right and an obligation!
Note how the Stone Mountain ordinance has to the best of my knowledge never even been challenged in court!