A veteran diplomat once gave me this advice: When you find yourself in a hole, stop digging.

When it comes to North Korea, the Bush administration appears to have violated this elementary rule of diplomacy again and again. It has gone from chafing at a diplomatic deal it didn't like, to calling the North "evil," to turning its back on the diplomatic deal after discovering violations, and now to standing by indignantly amid a burgeoning crisis.

Last week, the hole got deeper. Pyongyang said it would expel International Atomic Energy Agency inspectors. It covered up cameras and cut the wires that detect tampering with the canisters of spent plutonium fuel rods stored in an internationally monitored water tank. And it announced it would restart a nuclear reactor that had been closed since an agreement, known simply as the Agreed Framework, was struck by the Clinton administration in 1994. Although a separate effort by North Korea to enrich uranium was uncovered recently, by restarting the mothballed nuclear reactor Pyongyang can produce nuclear weapons-grade fuel faster and sooner for itself and perhaps for others, too.

Though Defense Secretary Donald Rumsfeld last Monday disparaged the Pyongyang government as one that does "idiotic things," the North Korean leadership has demonstrated a certain savvy for timing. With many of America's guns literally and figuratively aimed at Iraq, North Korea has chosen to engage in a bit of brinkmanship. By raising the specter that it might develop nuclear weapons, it is once again making the most of a weak hand and gambling that the Bush administration would opt for no more than one international confrontation at a time.

The North's goal might be to extract concessions from the United States. Another, more sobering possibility is that, having concluded that it is next on the U.S. hit list after Iraq, Pyongyang wants to get a credible nuclear deterrent as fast as possible. This new course could bring it half a dozen weapons by summertime. Either way, it's a dangerous gamble by the regime in Pyongyang. It is risking self-destruction.

The Bush administration has said there would be no rewards for nuclear blackmail. North Korea's ruler, Kim Jong Il, must think that there won't be any penalties, either. President Bush is known to admire Teddy Roosevelt, famous for saying the United States should speak softly and carry a big stick. But in this instance, the Bush administration has spoken loudly while waving its stick around elsewhere.

Could the Bush administration have handled North Korea in a different way to prevent this turn of events? Perhaps not. After all, North Korea's pursuit of uranium enrichment capabilities predated by a couple of years Bush's declaration that the country was part of the "axis of evil."

Perhaps Rumsfeld was right last week when he dismissed "the idea that it's the rhetoric from the United States that's causing them to starve their people or to do these idiotic things or to try to build a nuclear power plant." Certainly when I visited Pyongyang with then-Secretary of State Madeleine Albright two years ago, the country seemed suspended in time, more similar to the China of the Cultural Revolution era than the China of today. From the martial music in the Pyongyang Metro stations to the social-realist portraits of warfare against America, it seemed more like a country that felt itself under siege rather than opening up. That was when the Clinton administration was making nicer noises.

Yet the United States still needs to deal at some level with countries such as this, and the Bush administration's policy toward North Korea has been confused from the beginning. Many members of the administration and leading Republicans in Congress were obsessed with shredding the Agreed Framework that the Clinton administration had negotiated, and not without reason. It made little sense for North Korea to get, or even want, a light water nuclear reactor for electrical power generation when a fuel oil plant would have worked better and been built faster. But that's what the Agreed Framework provided, at North Korea's insistence.

To many Republicans, remedying the flaws in the accord represented more than a matter of bargaining. It became a moral crusade. With reports trickling out about repression and starvation in North Korea -- including pieces I wrote from Pyongyang and the Chinese side of the North Korean border -- many Republicans decided the United States should view the Kim Jong Il regime as one of unmitigated evil. Rather than look for a reason to reengage North Korea and renegotiate the Agreed Framework, they wanted to rip it up completely, not only ending the construction of the new, somewhat safer reactors but also cutting off fuel oil shipments to the North. After all, they were only propping up an immoral regime.

Beware what you wish for.

When North Korea admitted to Assistant Secretary of State James Kelly in October that it had a uranium enrichment program, many people in the administration and Congress saw the news as an opportunity to abandon the framework rather than as an emergency.

Here's where the administration's sense of moral clarity interfered with its chances of containing this crisis. It equated talking to North Korea with making concessions or, as one official put it, "caving in." How could the administration talk to a regime that is truly, in Bush's words, "evil"? These officials had lambasted the Clinton administration for its naivete when Albright went to Pyongyang to meet with Kim. And that was before we knew that North Korea was trying to enrich uranium.

Bush administration officials say they also feared that negotiating with North Korea after the admission would have set a bad precedent for other nations. There may be only a linguistic distinction between "talking" and "negotiating," but the world would have judged whether the United States had caved in by what emerged from such meetings. If Bush negotiators had obtained concessions from North Korea, that might have had a different effect. Instead, the administration hard-liners have confused process with results.

Rather than keep North Korea's confession secret, as it initially did, the administration should have pounced on the admission and preemptively demanded that North Korea return to the negotiating table to come up with tougher terms: cancellation of the reactor projects, acceleration of the required export of spent fuel rods from the older plutonium reactor, and destruction of the more recent uranium enrichment devices. International inspections, which the Agreed Framework did not require until the transfer of sensitive reactor technologies, should happen earlier.

One official involved in negotiating the Agreed Framework said he had long opposed the Bush administration's efforts to abrogate the deal. But, he said, "That was then. This is now." He said that North Korea had acted in a manner inconsistent with the spirit of the agreement and should pay a price.

But the administration has not appeared to have any strategy at all for exacting that price. It did not make demands, as it has with Iraq. It did not make any proposals, declaring that it would not "negotiate" until North Korea gave up all its nuclear weapons programs. One week Bush officials said they were calm and pursuing peaceful avenues. Last week, Rumsfeld talked of war and the White House plotted sanctions and containment. Meanwhile, Pyongyang is moving ahead. A U.S. official told The Post last week that the administration is playing hardball now. One observer quipped that so far it was doing nothing but taking strikes.

The United States has asked others, like Japan, Russia and China, to help bring North Korea to its senses. Meanwhile, the Bush administration has distanced itself from the "evil" regime by cutting off fuel oil shipments. But North Korea won't let itself be pushed away so easily.

A moral argument can be made for regime change in North Korea, which brutalizes its own citizens. In the absence of a strategy of regime change, diplomacy with such an odious regime might be another one of the world's evils, but a necessary one. If it's smart and tough, it might even produce some results. Steven Mufson is deputy editor of Outlook.