The first one was written, voted on and approved by the National Convention, a freely elected parliament in 1919. The second was written and voted on by the Parliamentary Council, made up from delegates sent by the freely elected state parliaments of the states of the three Western Zones of Germany (US, UK, French zone) in 1949. By then, there had been free elections for each of these states (four years having passed since WWII ended and the occupation began). After this, the state parliaments of the states that wanted to join this new “Federal Republic of Germany” ratified it - if two thirds of them ratified, it would be formed. All states except for Bavaria voted to ratify in the first vote, and after Bavarians realized the others had all approved, they also ratified it to become a state in the new Federal Republic of Germany.