North Korea tested a nuclear weapon last year , but has since cooperated in six-nation talks aimed at ending its nuclear weapons program .