MOSCOW -- President Mikhail S. Gorbachev emerged from his harrowing captivity last night visibly shaken but with his political allegiance remarkably unchanged by three days that transformed his nation.
As tens of thousands of joyous citizens marched through the streets to cheer the rout of the hard-line Communist leaders who had seized the government, and the entire capital seemed to celebrate the name of ex-Communist Boris N. Yeltsin, Mr. Gorbachev gravely told the world he still had confidence in the Communist Party.
"I am a committed socialist," he said, leaning on folded arms. "I'm a man of principle. I'll do everything in order to purge the Communist Party of reactionary forces. But I will make no concessions. I will fight to the end for the renewal of this party."
The Soviet president's vigorous defense of the party that was being damned outside the gates of the Kremlin as he spoke yesterday at his first news conference since the coup seemed to reflect that the fast-moving events of the last few days had left him behind. He dwelled on the accomplishments of his six years in office rather than trying to find some way to throw in his lot with Mr. Yeltsin, whose stature has been growing by the minute.
While Mr. Gorbachev was defending the party yesterday, Mr. Yeltsin, president of the Russian Federation, was assaulting it. He signed a decree ordering the Soviet army to rid itself of Communist cells. Just last month, Mr. Gorbachev was pressuring Mr. Yeltsin to reconsider such a move.
While Mr. Yeltsin was lowering the Soviet flag that flew over the Russian parliament building -- known as the White House -- and replacing it with a flag of old Russia, Mr. Gorbachev was replacing discredited Communists with new ones.
Mr. Gorbachev named Gen. Mikhail A. Moiseyev, the armed forces chief of staff, as defense minister to replace Gen. Dmitry T. Yazov, one of the arrested plotters. He replaced the disgraced KGB chief -- another coup-maker -- with the deputy KGB chief. And he put another old-line party official, Lt. Gen. Vasily P. Trushin, in charge of the Interior Ministry, to replace Boris K. Pugo, who committed suicide rather than face arrest for his part in the coup.
Of the eight coup leaders, five were arrested.
A sixth, former Prime Minister Valentin S. Pavlov, was hospitalized. Vasily A. Starodubtsev, chairman of the Farmers' Union of the U.S.S.R., was reported missing.
In an interview with a Soviet journalist reported by CBS, Mr. Kryuchkov said he had "deep respect" for Mr. Gorbachev and regretted participating in the week's events.
"If I were to reverse the time flow, some five or six days backwards, I would have taken an entirely different course so that I would not be sitting under arrest now," the bespectacled, 67-year-old veteran KGB official said in the interview.
Mr. Gorbachev's chief of staff and a key coup leader, Valery I. Boldin, was replaced by Grigory Revenko, a Communist Party official.
Mr. Gorbachev promised punishment for the plot's ringleaders as well as "a proper evaluation of those who waited on the sidelines and refused to oppose" the three-day coup.
He acknowledged making mistakes by trusting and promoting the men who later tried to overthrow him but said he had no idea they might betray him.
Indeed, the Soviet president resisted suggestions that he had brought the coup on himself by moving too slowly toward reforms and being too willing to compromise with the conservative Communists whom Mr. Yeltsin has been ridiculing.
Mr. Gorbachev showed some strain from his ordeal. Talking slowly at first, at times emotionally, he described his acceptance of imminent death after the chief of his security force led his captors to his summer retreat. He told of 32 personal guards who had promised to stay with him to the end. And he said his family had agreed to share his fate, whatever it might be.
He spoke without prepared remarks, and once he got beyond the torments of imprisonment and on to political matters, the language flowed forcefully and confidently.
But during the 1 1/2 -hour news conference, he gave no hint that he had adjusted to the seismic political shifts that occurred while he was being held at his dacha in the Crimea.
He insisted that Alexander N. Yakovlev, who was his senior adviser and an architect of perestroika, had been wrong to give up on the party and leave it. Both Mr. Yakovlev and another trusted aide, Eduard A. Shevardnadze, the former foreign minister, had pleaded with Mr. Gorbachev to do the same.
Mr. Gorbachev, who is general secretary of the Communist Party as well as president of the Soviet Union, seemed offended by the thought.
"I've been courageous enough over the years to say quite a lot of things about Stalin," he said yesterday. "We have to abandon that religious trust in classic Marxism. But we have to understand our own experience."