For most of American history since the Second Amendment was adopted the courts interpreted it as tying the second portion of the amendment to the first part of it. Thus the "right to bear arms" was tied to the need to establish a "well-regulated militia." The "state" was seen as individual states, and the modern national guard was seen as the descendant of this militia, especially given that the Founding Fathers supposedly did not see a permanent standing military body being something the national government would maintain. There have been debates about what these state level militias were supposed to do, with many arguing they were a sop to southern states who wished to be able to put down slave uprisings. But they could also be used by the national government for national purposes, with in fact George Washington using them to put down the Whiskey Rebellion. In any case, to the extent this right to bear arms was tied to this matter of being able to maintain a well-regulated militia, it clearly made this right not absolute and thus all forms of gun control constitutionally acceptable.
This long-established precedent was upended in 2008 when the Supreme Court made a decision written by the late Justice Scalia known as District of Columbia versus Heller, which ended DC's right to ban handguns. This hellish Heller decision determined that the right to bear arms was a fully distinct and all-but absolute right of individual people, even as it declared that there might still be some exceptions. Somehow the criteria for these exceptions was left somewhat vague, although laws against civilian ownership of machine guns remain in place, and it seems that restrictions on ownership by felons and people sufficiently mentally disturbed are allowed, so some cutoff involving public safety is still there.
Nevertheless, in spite of the ongoing spate of mass shootings, rumor has it that the SCOTUS may be about to further restrict the ability of governments to control guns, with a New York law allowing for regulation of who can openly carry guns in public possibly about to be declared in violation of the Second Amendment. This would constitute an extension of this noxious Heller decision rather than a move to increase the ability of governments in the US to exercise more gun control, something widely and strongly supported by the public, including conservatives and Republicans supposedly.
As it is, the way I see it, the matter comes down to one of punctuation. Is the latter portion of the amendment a subordinate clause to the former part or not? Heller seems to say that it is not, thus making the right to bear arms disconnected from the matter of needing a well-regulated militia. The amendment is in fact a single sentence, so the punctuation used becomes critical. For the latter part not to be a subordinate clause, it would need to be separated from the former part by a semi-colon. But it is not. In fact what one finds in the amendment is four commas. The latter part is subordinate and tied to the former part. It looks that the Founding Fathers did intend the right to bear arms to indeed be tied the matter of maintaining a well-regulated militia and thus not a stand-alone semi-absolute right.