MOSCOW, DEC. 20 -- Soviet Foreign Minister Eduard Shevardnadze, one of the principal architects of the breakthrough in East-West relations that led to the end of the Cold War, resigned today, saying he fears that the Soviet Union is heading toward dictatorship.

President Mikhail Gorbachev condemned the decision of his longtime friend and political ally, but insisted that there would be no changes in foreign policy. In a somber speech to the full legislature, he ruled out the possibility of an imminent military coup while insisting that "strong government" is needed to keep the country from slipping into political and economic chaos.

"Now, perhaps, is the most difficult time. But it is unforgivable {for Shevardnadze} to leave at such a moment. This must be condemned," the Soviet leader told more than 2,000 members of the Congress of People's Deputies meeting in the Kremlin. He added that he was "hurt" by Shevardnadze's failure to inform him in advance of his decision.

In both its suddenness and its political implications, Shevardnadze's departure is one of the most dramatic events in the 5 1/2-year history of perestroika, Gorbachev's movement to restructure national politics and the economy. Designed to emphasize the danger of a return to authoritarian rule, it also underlined the fragility of Gorbachev's position at a time of deepening economic crisis and growing ethnic tension.

Struggling to control his emotions, Shevardnadze told the Congress that he had grown tired of defending Soviet foreign policy from attacks by conservatives. Angry at his critics, he said it was his duty to resign as he could not reconcile himself to "what is happening in our country and the trials awaiting our people."

At Gorbachev's instigation, the Congress adopted a resolution, by 1,540 votes to 52, emphasizing the continuity of foreign policy and asking Shevardnadze to reconsider his resignation. But Foreign Ministry spokesman Vitaly Churkin said that the decision was "final" and the result of "careful consideration" over "many sleepless nights."

Over the last month, legislative conservatives have campaigned for the 62-year-old foreign minister's dismissal, accusing him of blindly following U.S. policy in the Persian Gulf and "one-sided concessions" in superpower arms negotiations. Even so, today's developments shocked and surprised many deputies who have come to regard Gorbachev and Shevardnadze as an inseparable political tandem.

Shevardnadze opened his speech by indignantly denying charges made at Wednesday's session of the Congress that he and Gorbachev were considering sending Soviet troops to the Persian Gulf. He called these charges "the last straw." As the gulf crisis neared a critical point, these circumstances raised fears in the West that Moscow's cooperation in the international campaign to force Iraqi troops out of Kuwait would not survive Shevardnadze's resignation.

Speaking from what appeared to be rough notes, Shevardnadze sounded a warning to fellow "democrats" and "reformers":

"A dictatorship is on the offensive. I tell you this with full responsibility. No one knows what this dictatorship will be like, what kind of dictator will come to power and what kind of order will be established."

He concluded his disjointed speech by insisting that he still regards Gorbachev as his friend and would support the ideas of perestroika "until my last days."

"I believe that a dictator will not succeed, that the future belongs to democracy and freedom," he told Gorbachev and the legislators, who listened in stunned silence.

Shevardnadze, who was appointed to head the Foreign Ministry in July 1985, only four months after Gorbachev came to power, did not go into details about the reasons for his alarm. But in a magazine interview last March, he warned that the failure of perestroika would lead either to the "total collapse of the state" or, more probably, "a dictatorship."

"A great dictator or a comic-opera one, it doesn't really matter," he said.

Gorbachev, under pressure from conservatives in both the armed forces and Communist Party, suggested Wednesday that he may be forced to declare direct presidential rule in troubled areas of the country. In addition to the three Baltic republics and Moldavia, on the Romanian border, he said he was worried by the situation in Shevardnadze's native Georgia, where a nationalist government came to power in elections this year.

Shevardnadze's resignation speech was greeted with a standing ovation by radical legislators, who have adopted a relatively low profile at the current Congress, dominated by hard-liners. But others accused him of "abandoning a sinking ship" and some questioned the stated reasons for his departure.

"Centuries of experience show that you should never take a diplomat's words at face value," said historian Roy Medvedev, speculating that the real reason for Shevardnadze's resignation lay in the "looming conflict" between the Kremlin and Georgia over whether to sign a new union treaty.

Shevardnadze, who served as Communist Party chief in Georgia from 1972 to 1985, has followed developments closely in his native republic. Last year, he threatened to resign as foreign minister unless the Kremlin carried out a full investigation into why soldiers fired on peaceful demonstrators in the Georgian capital, Tbilisi, in April 1989, killing 20.

Although Shevardnadze expressed his admiration of and support for Gorbachev, today's events seem likely to undermine their friendship. It is in some ways reminiscent of the sudden resignation of Moscow Communist Party chief Boris Yeltsin at a Central Committee plenary session in November 1987. Gorbachev never forgave his former protege for what he later depicted as an act of personal betrayal.

Gorbachev's aides said the president had asked Shevardnadze to stay on as foreign minister until a replacement could be found. In his own speech, the Kremlin leader praised his friend as a member of the small "team of pioneers" who had launched perestroika in 1985 in response to the drift and stagnation of Leonid Brezhnev's years, but appeared to criticize him for failing to understand the distinction between "dictatorship" and "strong presidential power."

"I have no evidence that we are on the brink of a coup by a military junta or a similar dictatorship," Gorbachev said. "On the other hand, if we lose our vigilance and fail to listen to the signals coming to us from various sections of society and if we lose the chance to strengthen our power, then a coup by a junta will become a distinct possibility. These are the lessons of history."

Gorbachev told the Congress that he had wanted Shevardnadze to assume the new post of vice president, but implied that this is now out of the question. Rumors have been circulating here for several months that Gorbachev planned to replace Shevardnadze as foreign minister with Yevgeny Primakov, his personal envoy on the Persian Gulf crisis.

Last month, the president dismissed Vadim Bakatin as head of the Interior Ministry, which is in charge of enforcing order throughout the country, after the Soyuz group of conservative deputies charged that he was too "soft" in his dealings with the republics. Soyuz, which claims the support of roughly 20 percent of the Congress, made clear at the time that Shevardnadze was its next target.

While praising Shevardnadze for drawing attention to the danger of authoritarian rule, radical legislators attacked him for being excessively sensitive to criticism. In his resignation speech, the foreign minister referred indignantly to a hostile campaign launched by two legislators "in colonels' epaulettes" -- a clear reference to Cols. Viktor Alksnis and Nikolai Petrushenko, the leaders of the Soyuz group.

"We must criticize Shevardnadze for showing weakness at a critical moment," said Ales Adamovich, a prominent filmmaker. "So you were insulted by a bunch of colonels. So what? After all, if a general, to say nothing of a marshal, orders a colonel to insult his own mother, he will do so without batting an eyelid."