The mention of the purpose of a well regulated militia in no way limits the protections of the Second Amendment to militias only.
In the early republic, many people and judges understood the Second Amendment to apply to the States as well as the federal government. The First Amendment states that "Congress shall make no law" the Second Amendment states that the right "shall not be infringed".
I was not aware of that. Do you have any links or court cases which support that?