The real reason the Second Amendment was ratified, and why it says "State" instead of "Country" (the framers knew the difference -- see the 10th Amendment), was to preserve the slave patrol militias in the southern states, which was necessary to get Virginia's vote. Founders Patrick Henry, George Mason and James Madison were totally clear on that... and we all should be too.
In the beginning, there were the militias. In the South, they were also called the "slave patrols," and they were regulated by the states.
In Georgia, for example, a generation before the American Revolution, laws were passed in 1755 and 1757 that required all plantation owners or their male white employees to be members of the Georgia Militia, and for those armed militia members to make monthly inspections of the quarters of all slaves in the state. The law defined which counties had which armed militias and even required armed militia members to keep a keen eye out for slaves who may be planning uprisings.
As Dr. Carl T. Bogus wrote for the University of California Law Review in 1998, "The Georgia statutes required patrols, under the direction of commissioned militia officers, to examine every plantation each month and authorized them to search 'all Negro Houses for offensive Weapons and Ammunition' and to apprehend and give twenty lashes to any slave found outside plantation grounds."
It's the answer to the question raised by the character played by Leonardo DiCaprio in Django Unchained when he asks, "Why don't they just rise up and kill the whites?" If the movie were real, it would have been a purely rhetorical question, because every southerner of the era knew the simple answer: Well regulated militias kept the slaves in chains.
Sally E. Haden, in her book Slave Patrols: Law and Violence in Virginia and the Carolinas, notes that, "Although eligibility for the Militia seemed all-encompassing, not every middle-aged white male Virginian or Carolinian became a slave patroller." There were exemptions so "men in critical professions" like judges, legislators and students could stay at their work. Generally, though, she documents how most southern men between ages 18 and 45 -- including physicians and ministers -- had to serve on slave patrol in the militia at one time or another in their lives.
And slave rebellions were keeping the slave patrols busy.
By the time the US Constitution was ratified, hundreds of substantial slave uprisings had occurred across the South. Blacks outnumbered whites in large areas, and the state militias were used to both prevent and to put down slave uprisings. As Dr. Bogus points out, slavery can only exist in the context of a police state, and the enforcement of that police state was the explicit job of the militias.
If the anti-slavery folks in the North had figured out a way to disband -- or even move out of the state -- those southern militias, the police state of the South would collapse. And, similarly, if the North were to invite into military service the slaves of the South, then they could be emancipated, which would collapse the institution of slavery, and the southern economic and social systems, altogether.
These two possibilities worried southerners like James Monroe, George Mason (who owned more than 300 slaves) and the southern Christian evangelical, Patrick Henry (who opposed slavery on principle, but also opposed freeing slaves).
Their main concern was that Article 1, Section 8 of the newly-proposed US Constitution, which gave the federal government the power to raise and supervise a militia, could also allow that federal militia to subsume their state militias and change them from slavery-enforcing institutions into something that could even, one day, free the slaves.
This was not an imagined threat. Famously, 12 years earlier, during the lead-up to the Revolutionary War, Lord Dunsmore offered freedom to slaves who could escape and join his forces. "Liberty to Slaves" was stitched onto their jacket pocket flaps. During the war, British General Henry Clinton extended the practice in 1779. Numerous freed slaves served in General Washington's army.
Thus, southern legislators and plantation owners lived not just in fear of their own slaves rebelling, but also in fear that their slaves could be emancipated through military service.
At the ratifying convention in Virginia in 1788, Henry laid it out:
"Let me here call your attention to that part [Article 1, Section 8 of the proposed Constitution] which gives the Congress power to provide for organizing, arming, and disciplining the militia, and for governing such part of them as may be employed in the service of the United States....
"By this, sir, you see that their control over our last and best defence is unlimited. If they neglect or refuse to discipline or arm our militia, they will be useless: the states can do neither ... this power being exclusively given to Congress. The power of appointing officers over men not disciplined or armed is ridiculous; so that this pretended little remains of power left to the states may, at the pleasure of Congress, be rendered nugatory."
George Mason expressed a similar fear:
"The militia may be here destroyed by that method which has been practised in other parts of the world before; that is, by rendering them useless, by disarming them. Under various pretences, Congress may neglect to provide for arming and disciplining the militia; and the state governments cannot do it, for Congress has an exclusive right to arm them [under this proposed Constitution].... "
Henry then bluntly laid it out:
"If the country be invaded, a state may go to war, but cannot suppress [slave] insurrections [under this new Constitution]. If there should happen an insurrection of slaves, the country cannot be said to be invaded. They cannot, therefore, suppress it without the interposition of Congress.... Congress, and Congress only [under this new Constitution], can call forth the militia."
And why was that such a concern for Patrick Henry?
"In this state," he said, "there are two hundred and thirty-six thousand blacks, and there are many in several other states. But there are few or none in the Northern States.... May Congress not say, that every black man must fight? Did we not see a little of this last war? We were not so hard pushed as to make emancipation general; but acts of Assembly passed that every slave who would go to the army should be free."
Patrick Henry was also convinced that the power over the various state militias given the federal government in the new Constitution could be used to strip the slave states of their slave-patrol militias. He knew the majority attitude in the North opposed slavery, and he worried they'd use the Constitution to free the South's slaves (a process then called "Manumission").
The abolitionists would, he was certain, use that power (and, ironically, this is pretty much what Abraham Lincoln ended up doing):
"[T]hey will search that paper [the Constitution], and see if they have power of manumission," said Henry. "And have they not, sir? Have they not power to provide for the general defence and welfare? May they not think that these call for the abolition of slavery? May they not pronounce all slaves free, and will they not be warranted by that power?
"This is no ambiguous implication or logical deduction. The paper speaks to the point: they have the power in clear, unequivocal terms, and will clearly and certainly exercise it."
He added: "This is a local matter, and I can see no propriety in subjecting it to Congress."
James Madison, the "Father of the Constitution" and a slaveholder himself, basically called Patrick Henry paranoid.
"I was struck with surprise," Madison said, "when I heard him express himself alarmed with respect to the emancipation of slaves.... There is no power to warrant it, in that paper [the Constitution]. If there be, I know it not."
But the southern fears wouldn't go away.
Patrick Henry even argued that southerner's "property" (slaves) would be lost under the new US Constitution, and the resulting slave uprising would be less than peaceful or tranquil:
"In this situation," Henry said to Madison, "I see a great deal of the property of the people of Virginia in jeopardy, and their peace and tranquility gone."
So Madison, who had (at Jefferson's insistence) already begun to prepare proposed amendments to the US Constitution, changed his first draft of one that addressed the militia issue to make sure it was unambiguous that the southern states could maintain their slave patrol militias.
His first draft for what became the Second Amendment had said: "The right of the people to keep and bear arms shall not be infringed; a well armed, and well regulated militia being the best security of a free country [emphasis mine]: but no person religiously scrupulous of bearing arms, shall be compelled to render military service in person."
But Henry, Mason and others wanted southern states to preserve their slave-patrol militias independent of the federal government. So Madison changed the word "country" to the word "state," and redrafted the Second Amendment into today's form:
"A well regulated Militia, being necessary to the security of a free State [emphasis mine], the right of the people to keep and bear Arms, shall not be infringed."
Little did Madison realize that one day in the future weapons-manufacturing corporations, newly defined as "persons" by a Supreme Court some have called dysfunctional, would use his slave patrol militia amendment to protect their "right" to manufacture and sell assault weapons used to murder schoolchildren.