Lie led the Norwegian "delegation" (group) to the United Nations conference in San Francisco in 1946 and was a leader in drafting the rules to set up the United Nations Security Council. He was the leader of the Norwegian delegation to the United Nations general assembly in 1946. On February 1, 1946, he was elected as the first United Nations Secretary-General as a result of a compromise between the major powers, having only missed being elected President of the first General Assembly by a small margin. He gets much of the credit for securing the current site for the United Nations headquarters from John D. Rockefeller, Jr., and establishing the offices there.