It couldn't be clearer, Zimbler0. The first part, "A well regulated Militia, being necessary to the security of a free State" is the reason why "the right of the people to keep and bear Arms, shall not be infringed."
The Founders wanted the people to be able to rise up, when needed, as a well regulated Militia.