Despite millions of people dying in labour camps or from poverty and starvation during Kim's 17 years in power, he is revered as a demigod by most North Koreans.
Hope and fear after N Korea's 'Dear Leader' dies
BEIJING // North Korea's "Dear Leader", Kim Jong-il, is dead - raising fears of instability in the Stalinist hermit state, but also hopes that a change of leadership might bring greater openness and reform.
A weeping presenter on state television, in a black traditional Korean dress, told viewers Kim had died from a heart attack on Saturday while carrying out official duties on a train.
"Kim Jong-il … passed away from a great mental and physical strain at 8.30 on December 17, 2011, on a train during a field guidance tour," she said. "It is the biggest loss for the party … and it is our people and nation's biggest sadness."
The announcement was replayed throughout the day, interspersed with hours of footage - backed by mournful music - of Kim visiting factories and military bases, and interviews with shocked and grieving citizens.
Kim, who was 69, will be succeeded by his third son, Kim Jong-un, the third leader from the Kim dynasty that has ruled the nation since its founding after the Second World War.
Despite millions of people dying in labour camps or from poverty and starvation during Kim's 17 years in power, he is revered as a demigod by most North Koreans thanks to a powerful state propaganda machine and a personality cult started by his father and predecessor, Kim Il-sung.
State television footage from Pyongyang showed thousands marching on the city's landmarks to mourn their leader's death.
Many cried uncontrollably. Some beat the ground with the fists or wailed at the sky.
Members of the ruling Worker's Party were crying out loud, banging tables and sobbing.
"I can't believe it. How can he go like this? What are we supposed to do?" said a distraught Kang Tae-ho.
"He tried so hard to make our lives much better and he just left like this," said Hong Sun-ok.
Kim's death seems to have been as much of a surprise outside as inside. Although thought to have suffered a stroke in 2008, he seemed to have made a good recovery, travelling to China and Russia in recent months.
He was last seen in public on Thursday visiting a supermarket and a music centre with Kim Jong-un.
China - North Korea's closest ally - said it was shocked by the announcement and South Korea's intelligence agency came under fire for not discovering Kim had died 48 hours before it was announced.
His sudden death comes at a precarious time. Next year, the country celebrates the centenary of Kim Il-sung's birth, by which time Kim Jong-il had promised the country would be a "strong and prosperous nation".
Instead, the Stalinist state is isolated internationally because of its controversial nuclear weapons programme and aid agencies say it is facing food shortages again this winter.
Additionally, Kim Jong-un is only in his late twenties and was relatively unknown inside North Korea until last year.
While North Korea-watchers said references to Kim Jong-un as the "great successor" in the state media illustrated a smooth transition of power, they cautioned that the young Kim may lack the experience and personal connections to hold the county's political elite together.
"Kim Jong-un is a pale reflection of his father and grandfather. He has not had the decades of grooming and securing of a power base that Jong-il enjoyed before assuming control from his own father, Kim Il-sung," said Bruce Klingner, a north-east Asia expert at the Washington-based Heritage foundation.
"Had Kim remained alive longer, it would have given Jong-un greater opportunity to develop his own independent power base of leadership elites loyal to him personally."
Mr Klingner and other experts said although North Korea's new leader was likely to hunker down to consolidate his power base, there was a chance he would carry out some kind of a military action to win the support of hardliners in the party.
"The danger now is that Kim Jong-un feels under pressure to demonstrate his legitimacy with nuclear tests or military provocations," said Michael Green, of the Centre for Strategic and International Studies in Washington.
But other observers point to Kim Jong-un's Swiss education and say that, in the long term, his youth and his experiences overseas might make him more likely to do a deal over his country's nuclear weapons programme or allow moderate economic reforms.
South Korea - which is still technically at war with the North - put its military on high alert after the news of Kim's death but said it had detected no unusual activity along its border.
North Korea's news agency, KCNA, said Kim Jong-il's body would lay in state until December 27 in the Kumsusan memorial in Pyongyang, where his father's embalmed body is kept in a glass coffin.
The following day, a "farewell-bidding ceremony" will be held in Pyongyang and the day after that a nationwide memorial service will be held when "all the people will observe three minutes' silence and all locomotives and vessels will blow sirens all at once", it said.
There was no mention of whether Kim would be embalmed and put on display in the Kumsusan memorial.
KCNA said foreign mourners would not be allowed.