Five weeks ago, President Bush sent Mikhail Gorbachev a confidential letter warning the Soviet leader not to expect a U.S.-Soviet trade deal when he came to Washington. Citing the public and congressional reaction to Gorbachev's economic blockade of Lithuania, Bush wrote that he would have great difficulty moving forward with a trade agreement and most-favored-nation trade status for the Soviet Union.

Secretary of State James A. Baker III repeated this message in mid-May when he visited Moscow; the same word was passed again in a diplomatic message through Soviet Ambassador Alexander Bessmertnykh just hours before the summit began.

But last Friday night, 48 hours after Gorbachev arrived in Washington for the summit, Bush abruptly reversed himself. Pressed by Gorbachev from the moment of their first meeting to approve a trade agreement, Bush and his advisers decided -- after testing the reaction of congressional leaders who also had heard Gorbachev plead for a trade deal -- to do the Soviet leader the one favor he most wanted. Friday evening, a trade agreement -- of marginal practical significance, since it did not immediately provide most-favored-nation status, but nevertheless a trade agreement -- was signed by Bush and Gorbachev in the East Room of the White House.

Although Bush's letter to Gorbachev has not previously been made public, Bush had publicly suggested that as long as the economic blockade continued, U.S. trade benefits for Moscow would not be politically feasible. "Let's hope there's some progress on the Lithuanian question, because I think many feel there's a direct linkage there, and I must say it concerns me," Bush said May 24. His change of heart was the most significant spontaneous event at the summit; it reveals the state of mind of both presidents as they grappled with the implications of Gorbachev's domestic woes.

This was a summit of low expectations and, in the end, minimal results on German unification, arms control and other substantive issues before the two nations. The trade agreement was one of only two surprises; the other was the extraordinary personal rapport that developed between the two leaders, most dramatically displayed in an emotional exchange of toasts at a private dinner at Camp David Saturday night.The Lithuania Blockade

Moscow cut the flow of gas and oil to Lithuania on April 18, challenging the breakaway Lithuanian government and its supporters in the West. The Bush administration reacted with cautiously exerted pressure on Moscow to open a dialogue with the Lithuanians. But the pressure had no effect. A crisis atmosphere began to develop.

Bush scheduled a meeting of the National Security Council at which many, including administration officials, expected him to announce some form of sanctions against the Soviets. But at that meeting on April 24, Bush decided not to apply economic sanctions. His decision prompted Lithuanian President Vytautas Landsbergis to compare Bush to Neville Chamberlain, the British prime minister who appeased Hitler at Munich. Less than a week later, without public announcement, Bush linked the trade accord with the fate of Lithuania in his private letter to Gorbachev.

A source familiar with the letter said Bush took pains to assure Gorbachev that his inability to move forward with a trade pact did not mean he had abandoned his support for perestroika. Bush indicated he was simply reflecting political reality in Congress, where outrage over the Soviet crackdown was running strong. On May 1, the day after Bush sent his letter, the Senate asked the president by a 73 to 24 vote not to send the U.S.-Soviet trade agreement to Capitol Hill while the Soviet blockade of Lithuania continued.

Just a day after Baker delivered a similar message to Foreign Minister Eduard Shevardnadze in Moscow May 16, Gorbachev raised U.S. hopes by holding an unexpected conciliatory meeting with Lithuanian Prime Minister Kazimiera Prunskiene. Eight days later Gorbachev met with another delegation of Lithuanian officials, and was even more forthcoming, suggesting that independence might be possible in two or three years if the Lithuanian parliament would suspend its declaration of independence. But the full-scale dialogue sought by Washington never developed.

As the summit approached, the trade pact was in limbo. The Kremlin suddenly withdrew from consideration in the Supreme Soviet a new law codifying more liberal Soviet emigration practices. The Bush administration has insisted that such a law be passed to satisfy the Jackson-Vanik amendment tying most-favored-nation status to unrestrictive emigration policies. The Soviets seemed to be signaling that they knew there would be no trade deal at the summit.

In the days before the summit, the economic policy-makers of the administration, including Treasury Secretary Nicholas F. Brady and Commerce Secretary Robert A. Mosbacher, sent a joint memorandum to Bush outlining the case for signing the U.S.-Soviet trade agreement and granting most-favored-nation trade status to Moscow. Among the points they made, according to official sources, was that Europeans and others are moving quickly into the Soviet market, leaving American business at a disadvantage. But the letter noted that the decision was a "geopolitical" one for Bush, and had become involved in domestic politics.

After a White House meeting on the subject, the decision to keep the trade agreement on the shelf was reconfirmed. The Soviets were informed through Bessmertnykh that the agreement would not be signed at the summit, according to a U.S. official.Gorbachev's Persistence

Soon after Gorbachev and Bush walked through the Rose Garden to the Oval Office last Thursday morning, the Soviet leader made clear his main interest -- the trade agreement. At that one-on-one meeting, he cast the issue as vitally important to his perestroika reforms. According to a senior U.S. official, Bush reminded Gorbachev of the political realities in Congress as long as Moscow continued to pressure Lithuania. Gorbachev pressed his case with Bush again in a private conversation at the White House State Dinner Thursday night, while other members of Gorbachev's official party lobbied administration officials intensely. Some Soviet officials were passing the word that the new five-year agreement on Soviet purchases of U.S. grain, which is of great interest to U.S. farmers, might not be signed in the absence of the trade agreement.

At the Soviet Embassy Friday morning, Gorbachev delivered a passionate appeal to congressional leaders. A favorable gesture from Congress on trade "would open up opportunities for us and for your businessmen . . . because they've been prodding us for years to scrap those anachronisms of the Cold War." He added with disarming candor, "I think it is very important that you make this gesture, mostly from a political standpoint."

Bush was watching every word from the Oval Office on Cable News Network's live broadcast of Gorbachev's meeting with the lawmakers. "Bush heard something and was immediately responsive to it," said an administration official. Shortly thereafter, the president ordered administration aides to sound out each of the congressional leaders who had been at the Soviet Embassy about their reaction to Gorbachev's trade appeal and their probable reaction if the trade agreement were to be signed. Ten of the 12 participants were reached; some supported signing the trade deal, others expressed reservations.

There was no consensus inside the administration. Some officials worried that the concession would overshadow the strategic and chemical weapons accords being announced at the same time late Friday, or would antagonize congressional conservatives. Others asked what the United States would get in return for such a concession.

In the end, according to a Bush aide who was involved in the discussions, the president decided that he wanted to help Gorbachev. Bush was concerned about the Soviet president's domestic difficulties, recently aggravated by panic buying of food in Moscow after the announcement of price increases tied to new economic reforms. Bush also was swayed by the argument that support for Gorbachev was the right choice, because ultimately Lithuania's fate would likely be decided by him. More than anything else, Bush "was influenced by his discussions with Gorbachev," this official said.

The final arrangements for signing the trade pact took place in a flurry of last-minute conversations. The Soviet side was notified only shortly before the East Room ceremony that Bush was prepared to go ahead, but that he also would make it clear the trade agreement would be sent to Congress only after Supreme Soviet passage of the emigration bill. The deal to be signed would not include most-favored-nation tariff status for Soviet products.

Suddenly the link between the trade deal and Lithuania disappeared from official U.S. rhetoric. An hour after the signing, Baker insisted to incredulous reporters that "we, as far as I know, have never stated an expressed linkage with respect to the question of Lithuania" in connection with the trade agreement.Germany's Future Alignment

In advance of the summit, U.S. officials hoped for a meeting of the minds between the two leaders on the most difficult issue arising from the revolutionary changes in Europe -- the future military alignment of a united Germany. But it became clear on the first afternoon of the summit that Gorbachev was not ready to discuss practical solutions to the complex problems.

After introductory remarks by Bush, Baker reviewed the nine assurances that had been discussed with U.S. allies and previously presented to Gorbachev in the Kremlin as a way to assuage Soviet concern about a united Germany in NATO. Bush and Baker were prepared to go beyond the initial statement if Gorbachev wanted to, but the Soviet leader "did not respond" to the nine points, according to a participant in the meeting.

Gorbachev, instead, launched into a rambling and largely philosophical discourse, similar to the remarks he made publicly in the windup news conference of the summit Sunday morning. Although a written Soviet plan for a new 35-nation European security organization had been handed to the State Department on the eve of the summit, Gorbachev did not even mention it in the Cabinet Room, according to U.S. sources.

The Soviet leader had only two suggestions: that Germany have a place in both NATO and the Warsaw Pact, which Bush dismissed as impractical; and that a possible political relationship between the two military alliances might help resolve Germany's future. Baker said later the United States would follow up on the latter suggestion.

Gorbachev also said in passing that perhaps the Soviet Union should consider joining the NATO alliance, which had been its nemesis throughout the Cold War. Bush responded that the NATO supreme commander has always been an American, and wondered aloud how Marshal Sergei Akhromeyev, an illustrious Soviet soldier who is now Gorbachev's military adviser and who sat at the table in the Cabinet Room, would like serving under an American general.

U.S. officials concluded at the end of this meeting that it will take months, perhaps many months, to resolve the German issues in ways that are politically tolerable for the Soviet Union.Arms Control Negotiations

Bush said last December that the Washington summit was vital to "drive the arms control agenda." But though much time was spent on arms control issues by teams of U.S. and Soviet experts who gathered here four days before Gorbachev's arrival, little progress was made on the central issues, and arms control was not a major preoccupation of the two leaders.

A Bush-Gorbachev exchange Friday morning on arms control issues led to a special afternoon negotiating session between Baker and Shevardnadze, aimed at completing as much of the agenda as possible in time for the signing ceremony. By long-standing plan, the two leaders intended to sign a statement outlining a strategic arms reduction treaty that they hope to complete and sign by year's end, and also a statement of principles guiding negotiation of a second treaty later. "I wouldn't call it disorderly, but it was intense," a senior U.S. official said of the final negotiating session.

The United States demanded that the Soviets agree now to a future ban on the largest ICBMs, known as heavy missiles, and to the eventual elimination of U.S. and Soviet land-based missiles with multiple warheads. U.S. officials say these are the most threatening weapons because they could be used in a preemptive nuclear strike.

Soviet officials responded that such constraints would eliminate their most powerful and plentiful nuclear weapons, while leaving the United States with an undiluted advantage in sea-based weapons. Such a deal would be "incomprehensible," according to Akhromeyev, speaking in an interview after the summit.

Soviet negotiators proposed that future strategic arms negotiations achieve steep, overall reductions, which the U.S. team resisted. A sticking point, eventually resolved in U.S. terms, arose over the issue of space weapons: Should there be future "negotiations," as Washington proposed, or "consultations," in the words of Moscow?

Late Friday Baker and Shevardnadze accepted vague language that incorporated some of each side's positions. The statement on future negotiations issued by the sides at the East Room signing ceremony had not even been duplicated for distribution to the press at the time it was signed.

A U.S. official cited the presence at the summit of Col. Gen. Bronislav Omelichev, a first deputy chief of staff of the Soviet army, as a symbol of Gorbachev's diminished flexibility. Omelichev appeared on the scene as the military's representative in arms negotiations only a few weeks ago, and left Americans with the impression that "clearly his views count for very much."

From the first, Bush wanted to spend time away from Washington with Gorbachev during this summit, perhaps at his summer home in Kennebunkport, Maine. But the Soviets insisted on an all-business summit. They even resisted a visit to Camp David.

But they finally agreed, and the relaxing environment of the presidential retreat cast its spell on Mikhail and Raisa Gorbachev as it has on many foreign visitors. On the patio of Aspen Lodge, Bush, Gorbachev and just a handful of aides spent more than two hours in a globe-girdling conversation about regional hot spots. Officials said later those conversations were some of the best ever held between Soviet and American leaders, though apparently no definitive agreements were reached.

Barbara Bush and Raisa Gorbachev strolled through the grounds, often hand in hand. The tone of the discussions between their husbands notably softened as they unwound in the Catoctin Mountains atmosphere, a participant said.

In mid-afternoon, Gorbachev and his wife walked past one of the horseshoe pits where Bush plays one of his favorite games. The Soviet leader tossed a ringer on his first try, to the astonishment of everyone present.

At an informal dinner that night in Laurel Lodge, Bush brought up the incident at the end of his toast to Gorbachev. As a participant recalled it, Bush said that the day at Camp David had been important to the relationship of the two men and their nations. But, Bush added, "this isn't going to be all sweetness and light. I am a sportsman, a real competitor. I like to win." And who could imagine, he went on, that "Mikhail" could score ahead of him in one of Bush's favorite pastimes. The president reached under the dinner table and presented Gorbachev with a wooden plaque on which Navy personnel had mounted the horseshoe with which he had thrown the ringer.

Gorbachev, who was described by an American participant as on "a kind of high" as a result of the day's intimacy and informality, made an emotional speech in return. "In our country, the horseshoe over the door means good luck," the Soviet leader said, according to the notes of an American participant. "May this one be over the door of your house and my house and over the door of the American people and give us good fortune."

Staff writer R. Jeffrey Smith contributed to this report.