Manuel A. Noriega lost the battle of Panama City to the U.S. military in December 1989, but he is winning the war out of the federal courthouse in Miami. Stubbornly, stupidly the United States is slogging ahead with a trial that has become a circus, a trial that never should have been.

No one who has read the public record of recent years can doubt that Noriega was involved in drug smuggling, conspiracy and racketeering, as charged, along with other at least equally heinous or foolish crimes such as sadism, murder and being an ally of the United States.

Americans are fascinated by and love to hate Noriega because he was the consummate double-dealer, manipulating and betraying everyone at one time or another, but sufficiently useful to most, including the United States, that marriages of convenience were long maintained.

It's hard to find the first mistake Washington made in the Noriega affair. Some argue we should never have worked with him, but that too is a complex issue we cannot resolve here, with good and bad arguments on both sides.

We could have avoided all this if Noriega had been turned loose when he left the Vatican Embassy in Panama in January 1990, there to face the justice of those he had betrayed, including the Panamanian people and the Medellin cartel. Instead, we brought him safely to the United States.

Here he is charged with drug-related crimes, but Noriega is no Pablo Escobar. His case is far more complex, though the prosecution is trying its best to hide this basic truth. The issues here are the legal, moral and practical consequences of several decades of U.S. cooperation with this gangster -- and then our self-righteously dumping him -- in the context of international affairs that now seem to belong to another century. And the issues are the well-being of Panama, the canal and U.S. interests in the hemisphere.

Many American politicians, the media and others can't grasp this because of a lust for playing domestic politics with foreign affairs, in this case standing tough against a drug dealer, and an inability to see beyond the obvious to distinguish a part -- even a small part -- from the whole.

The basic issue with Escobar is drugs, but with Noriega it isn't. The latter had been an ally of convenience for decades despite his strong-arming of Panamanians, his involvement in drugs, his transparent ties to Fidel Castro and other activities that will be tossed up in Miami, which we have known about since the Nixon era.

At the very least ties should have been ended quietly before the showdown began in Panama in mid-1987, as some in the Reagan administration wanted to do. With the safe haven offered by Spain, and appropriate pressures and dollars, Noriega could have been bought off or otherwise removed, avoiding the Miami circus, the economic sanctions, which during 1988-89 nearly devastated Panama and are still felt today, not to mention the invasion itself.

The indictment on drug charges in February 1988 was the next major mistake, for it pushed Noriega into a corner and made a nonviolent resolution of the crisis virtually impossible. When Reagan made a final effort to negotiate Noriega out several months later, presidential candidate Dukakis and others screamed about "deals with drug dealers" and then-vice president Bush lacked the political courage to openly support the president.

The Miami trial, which started yesterday, is not in the security interests of the United States, though it will cause less harm now than it would have several years ago. It will air all sorts of dirty linen -- some of it legitimately dirty in an often dirty world -- which would be better left in the hamper. Much of the material requested by Noriega's lawyers has been denied, in fact, because it is sensitive for assorted reasons but supposedly on the untrue grounds that it is irrelevant. Thus Noriega will not be able to back up the broader case he has every right to make to put his activities, and Washington's acquiescence in them, in true perspective.

The trial will smudge the image of the United States in Latin America and beyond. Noriega was roundly condemned by democratic leaders throughout the hemisphere. But our deposing him and putting him on trial in this country -- the first time for a foreign former head of state -- looks to many like the gringos beating up again on Latin Americans. We simply don't need this during what could be the most productive period of hemispheric relations in history.

This impression is hardened by the fact that so much of the case against Noriega is being made on the testimony of his former cronies, most of them "bought" by the legal device of plea-bargaining, so far to the tune of at least $1.5 million. A fine image of justice we are portraying.

If we can buy off these thugs, why couldn't we have bought off Noriega years ago and avoided all that the crisis has brought? Even now, the United States has far more to lose than gain by pursuing this trial. Even today it would be better to settle this nasty business out of court.

The writer, a senior research fellow at the Hoover Institution, has visited Panama frequently in recent years.