Margaret was working toward a union of Sweden with Denmark and Norway by having Olaf elected to the Swedish throne. She was on the verge of achieving this goal when Olaf IV suddenly died. However, Denmark made Margaret temporary ruler upon the death of Olaf. On 2 February 1388, Norway followed suit and crowned Margaret. Queen Margaret knew that her power would be more secure if she were able to find a king to rule in her place. She settled on Eric of Pomerania, grandson of her sister. Thus at an all-Scandinavian meeting held at Kalmar, Erik of Pomerania was crowned king of all three Scandinavian countries. Thus, royal politics resulted in personal unions between the Nordic countries, eventually bringing the thrones of Norway, Denmark, and Sweden under the control of Queen Margaret when the country entered into the Kalmar Union.