The Framers intended to prevent another instance of a foreign occupying force facing a legislatively-disarmed populace by making sure militias could keep and bear arms. All the nonsense since about 1798 about it is contrary to the original premise.
Ah no, it is in place to keep the Government in check. A dis-armed citizenry is easier to control, where as armed citizens have the capacity to rise up and overthrow a corrupt tyranical gov't.