“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 Second Amendment is a compound sentence with an independent clause preceded by two modifying dependent clauses.
The Supreme Court interprets “A well-regulated militia.” as implying the imposition of proper discipline and training.” IMPOSED proper discipline and training. People that argue the second amendment protects gun ownership usually ignore this fundamental point.
Paraphrased, the second amendment modifies the keeping of arms with regulation through compelled discipline and training.
The second clause, “being necessary to the security of a free state,” modifies the first and main parts. Why do we need a well-regulated militia? It is needed "To protect the security and freedom of the state."
It is this simple. Well regulated gun ownership the security of the free states is the only function for which well-regulated gun [ownership] is guaranteed.
To paraphrase, the first two, modifying clauses establish that a well-regulated and trained militia that is necessary for the security and freedom of the states.
The final part, “the right of the people to keep and bear arms shall not be infringed”, is equally clear, but maybe not at first glance. It establishes the right of “the people.” This is tied to something called the “body politic.” It’s a phrase you might have heard from some bloviated gas-bag posting in a highfalutin’ journal… ahem… and have a decent sense of what it means, yet never really checked. I used to think it meant the body of politics.
It actually means, “the people of a nation, state, or society considered collectively as a group of citizens,” and “a group of persons politically organized.” A body politic is also “a metaphor in which a nation is considered to be a corporate entity.” (Under the old use of the word corporate, also known as a municipal corporation...)