FIRST THE two German states' representatives signed the document, then the foreign ministers of the four allied countries that defeated Hitler 45 years ago. It was one of the great moments in this century's diplomacy, and certainly one of the most hopeful. Under this treaty, in less than three weeks a unified Germany will come into existence -- peaceful, democratic and fully sovereign.

It is the Soviets who have set the pace of this extraordinary change during the past year as they relinquished control over their East German colony, for nearly two generations the key to their security system in Europe. But like other colonial powers they had come to realize that their colony was costing far more than it benefited them, and it only detracted from their real security. President Gorbachev has now set it free in a way that will assure the Soviets of a maximum of goodwill from a Germany that will be the strongest country in central Europe and one of the world's great financial powers.

To get to that signing ceremony, the negotiators had to resolve a series of enormous questions during the past six months. After long resistance, West Germany's Chancellor Helmut Kohl finally acknowledged the Polish border as legitimate and permanent. He then persuaded Mr. Gorbachev, also after long resistance, to accept a unified Germany that belongs to NATO. Last week Mr. Gorbachev talked the Germans into pledging $8 billion to support the Soviet troops in East Germany before, and especially after, their return home. That subsidy, incidentally, constitutes a devastating commentary on the state of the Soviet economy. Now that East Germany has adopted the West German mark, the Soviet soldiers' pay is worthless and their families are suffering real hardship. Some of the $8 billion will be used to help them in East Germany, but most of it will go into the construction of housing for them in the Soviet Union -- the housing shortage there is a severe constraint on repatriation -- and into training them in skills that they can use to earn a living in civilian life.

When Germany is formally unified on Oct. 3, it will be the third time in this century that new German states have been founded. First came the Weimar Republic, born in revolution after World War I and disastrously weakened by the isolation and turmoil that followed. Then there were the divided pair of states set up respectively by the Western allies and by the Soviets in 1949 at the height of the Cold War, during and immediately after the Berlin blockade. The circumstances surrounding the establishment of the next Germany are, of the three, incomparably the happiest and the most promising.