South Korea's spy agency said Tuesday it has solved the mystery of North Korean leader Kim Jong Un's 6-week public absence, which set off a frenzy of wild speculation around the world.

The National Intelligence Service told legislators that a foreign doctor operated on Kim in September or October to remove a cyst from his right ankle, according to Park Byeong-seok, an aide for opposition lawmaker Shin Kyung-min. The aide said the spy agency also told lawmakers in a closed-door briefing that the cyst could recur because of Kim's obesity, smoking and heavy public schedule.

After last being seen in state media on Sept. 3, Kim reappeared on Oct. 14 hobbling with a cane, but smiling and looking thinner. The speculation during his absence was particularly intense because of the Kim family's importance to impoverished, nuclear-armed North Korea. The family has ruled the country since its founding in 1948.

It wasn't immediately clear how the information was obtained by the spy agency, which has a spotty track record of analyzing developments in opaque North Korea.

The agency also said North Korea has expanded five of its political prisoner camps, including the Yodok camp, which was relocated to the northwest city of Kilchu, according to Lim Dae-seong, an aide to ruling party lawmaker Lee Cheol-woo, who also attended the briefing. The spy agency believes the camps hold about 100,000 prisoners, Lim said.

He said the agency also believes that North Korea recently used a firing squad to execute several people who had been close to Kim Jong Un's uncle, Jang Song Thaek, who was considered the country's No. 2 power before his sudden purge and execution in December 2013.

In an intelligence success, South Korea's spy agency correctly said that Jang had likely been dismissed from his posts before North Korea officially announced his arrest.

However, it received heavy criticism when its director acknowledged that it had ignored intelligence indicating North Korea's impending shelling of a South Korean island in 2010. It also came under fire because of reports that it only learned of the 2011 death of then leader Kim Jong Il, the father of Kim Jong Un, more than two days after it occurred when state media announced it to the world.