It's a hard truth to stomach, but we will have to talk to Kim Jong Il

Twenty years after the demise of the communist Evil Empire, the world has begun to struggle when it comes to credible international supervillains. Robert Mugabe? Horrible, certainly, but also rather pathetic. Vladimir Putin - sinister, perhaps, but hardly foe to all humanity. Even Mahmoud Ahmadinejad in Iran lacks the edge somehow, and it's been far too long since Osama bin Laden put in an appearance. In the global obnoxiousness rankings there is only one serious contender, leagues ahead of anyone else: the North Korean leader, Kim Jong Il.

He's got the bizarre personality cult (“Dear Leader”, “Lodestar of the Twenty-First Century” etc). He's got the crazed haircut and Dr Evil pantsuit. He's got the devastating superweapons (about half a dozen nuclear warheads, by most estimates). And yesterday morning, puny mortals across the world quailed in terror as his latest evil scheme streaked across the sky - an intercontinental rocket fired high into the atmosphere above Japan. That the rocket failed to make it into orbit seems not to matter that much. If the reviews are anything to go by, this was the most dastardly act of villainy since the days of Goldfinger and Ernst Stavro Blofeld. The UN Security Council met in emergency session. Red telephones rang on desks across the world as governments from the United States to New Zealand issued sternly worded communiqués. The Japanese military got so overexcited that it jumped the gun - not once, but twice - and mistakenly announced that the rocket had gone up on Saturday. But this near-hysterical reaction, and the crude caricaturing of Mr Kim, serve only to distract from the reality of North Korea as it confronts the world, and to blind us to the very few feasible solutions.

For he is neither a madman nor a fool. Understood on his own terms, his actions have a logic and even a warped wisdom, and have seen him through a decade-long emergency that would have put paid to a lesser leader. No one could ever reasonably defend the North Korean regime, which competes with the worst in history for its cruelty and absurdity. But it is time for the rest of the world to try a bit harder to understand Mr Kim's actions, as well as condemning them.

Like all the biggest international headaches, Mr Kim did not come out of nowhere. He is the product of Korean history, one of the most stubbornly violent and traumatic in Asia. As a small but strategically positioned country surrounded by big powerful neighbours, Korea had been battered by invasion and exploitation for centuries. In 1945, Allied victory brought an end to harsh Japanese colonial rule, but replaced it with something even worse - national division between the Russian-backed North and the American-sponsored South. Today, South Korea is a vigorous democracy, but until 20 years ago it was a harsh dictatorship run by right-wing generals who, for ruthlessness and brutality, gave the Communists in the North a run for their money. The civil war of the early 1950s killed millions as it raced back and forth along the narrow peninsula. It ground to a stalemate not with a permanent peace, but with a temporary armistice that has never been replaced by a binding treaty. The Korean War, in other words, never formally ended - and Mr Kim and his army have never stopped fighting it.

The late 1980s, a moment of ecstatic liberation elsewhere in the world, increased North Korea's already acute sense of crisis and isolation. The end of the Soviet Union, and gradual liberalisation in China, deprived it of its economic and political supporters. Mr Kim's father, the founding leader Kim Il Sung, died in 1994. North Korea's economy collapsed; in the late 1990s, famine killed perhaps as many as several million people

Across the barbed wire and mine-encrusted border is the highly trained South Korean Army, backed up by US Marines and warplanes. In neighbouring Japan sits another US army and an aircraft carrier fleet, and there are nuclear weapons to hand on the Pacific island of Guam. This is the world that Kim Jong Il sees when he peers out at the world from Pyongyang: to the north, the irritated indifference of the Chinese, and in every other direction lethally armed and impatient hostility.

Is it remotely surprising that a leader in this situation - without friends, without functioning industry or agriculture, surrounded on all sides by great powers, overrun and invaded throughout history, and in a psychological state of permanent war - should turn to the one institution that continues to support him, the military, and do what he can to strengthen it?

It has worked for him so far - there can't be much doubt that without a powerful army capable of inflicting a bloody nose on any invader, Mr Kim would have gone the way of Saddam Hussein several years ago. In the absence of a military solution, the rest of the world has two choices: to talk to the North Koreans, or not to talk to them.

Negotiating is hard to swallow, because Mr Kim's regime is so obnoxious, stubborn and indefensible. You feel dirty dealing with such people, which is why the Bush Administration began by refusing to deal with the North Koreans unilaterally. Mr Kim didn't mind too much - as the Americans were holding their noses, he took out an insurance policy, reactivating a frozen nuclear power plant and setting his nuclear scientists to work. By the time President Bush's people had executed their U-turn and got round to talking to the North Koreans one to one, they had assembled, and subsequently tested, a handy arsenal of nuclear warheads.

It is these that the world should be concerned about - not yesterday's rocket that genuinely does appear to be, as North Korea claims, the launch vehicle for a communications satellite rather than a ballistic missile. Even if it is a weapon capable of reaching Alaska or Hawaii, there is no realistic threat to either of those territories: Mr Kim understands very well the fiery vengeance that would fall on his head in return for any attack on US soil.

The only practical way of bringing change to North Korea is by talking to North Koreans, and by compromising with them in ways that will at times be difficult to stomach. For several years, a series of multilateral meetings - the six-party talks - have made grinding progress towards a settlement, and this should continue. But it will all move all the quicker if we see Mr Kim for what he is - a scared orphan of history in a supervillain's outfit, who is much more afraid us than we are of him.

Richard Lloyd Parry, Asia editor of The Times.