North Korea had pledged to give up its nuclear weapons in return for energy aid and security assurances at talks in Beijing .