At the end, it came down to the two most intractable issues, Jerusalem, a city holy to three faiths, and the Palestinians, the people who once occupied the land that is now Israel.

It was Sunday, Sept. 17, a warm, clear day in Frederick County, Md. President Carter had been up until the early morning hours that day in a grueling meeting with Israeli Prime Minister Menachem Begin and two of Begin's top advisers.

They had agreed, at that meeting, to a formula involving Israeli settlements in the former Egyptian territory of the Siani peninsula that appeared to clear the way for a peace treaty between Egypt and Israel. But no such treaty would ever be possible if there was not agreement on the other two issues.

On Sunday afternoon, Carter walked out of Aspen Lodge, his quarters at Camp David, the presidential retreat in the Catoctin Mountains. He walked across the lawn to Birch Lodge, which for the last 13 days had been Begin's home. He carried with him some photographs of himself, personally inscribed to Begin's grandchildren. He also carried the latest draft of a proposed letter from the government of the United States to the governments of Israel and Egypt setting out the U.S. position on Jerusalem, once a part of Jordan and now claimed by Israel.

Less than eight hours later, Carter, Begin and Egyptian President Anwar Sadat would step off a helicopter into the floodlights that bathed the South Lawn of the White House. They would be brimming over with smiles, and a few minutes later the Israeli and the Egyptian, the two old enemies, would embrace each other as the president and a national television audience of millions watched.

It was a moment of political triumph for Carter. But his smile, and the smiles of the others, masked out only the fragile and uncertain future of the agreements that were reached at Camp David but also the remarkable process that produced them and left all of the participants exhausted.

The full story of the 13 days of Camp David may never be known. But it is now possible, using information from a variety of sources including Sadat's and Begin's public statements, to begin piecing together at least a partial picture of the extraordinary summit conference that produced two "frameworks" for a possible peace in the Middle East.

It is a story of endless meetings that stretched into the early morning hours of every day, of a slow building up of pressure, of a threat by Sadat to walk out and a final scramble to put it all together under an American imposed deadline which, intentionally or not, appears to have helped clear the final hurdles.

The president arrived at Camp David on Sept. 4, Labor Day, to mullover alone the task that lay ahead.

The next day the others, first Sadat and then Begin, arrived, to be greeted warmly at the Camp David helipad by the president and Rosalynn Carter.

They had their pictures taken but they said nothing. It was the beginning of the American-imposed "news blackout" that was effective beyond the wildest dreams of White House press secretary Jody Powell.

In the beginning, Carter probed the other two men's thoughts in separate meetings first with Begin and then Sadat. On Wednesday, Sept. 6, the first full day of the summit, he brought them together for the first time on the patio behind Aspen Lodge.

It did not go well. For months, the Israelis had been challenging Sadat to come up with a new proposal to settle their differences. That Wednesday, Sadat took up the challenge, throwing on the table a new Egyptian proposal that was totally unacceptable to the Israelis.

The three leaders met alone and the details of that first exchange are not known. But the president has told a congressional delegation that it was acrimonious and heated.

Carter would bring Sadat and Begin together again the next day for another five hours of meetings, but it was already clear to him that if there was to be any progress at Camp David the other two would have to be kept apart. After the third day of the summit, they would not meet again in a formal negotiating session.

By the first weekend of the summit, as Begin remained in his cabin to observe the Jewish sabbath, the situation did not appear hopeful. According to American officials, it was at this time that there was informal agreement among the three delegations that it was time for the United States to make its own proposals to see if the differences could be bridged.

Six miles east of Camp David, in an American Legion hall in Thurmont, Md., Powell gave reporters the first characterization of the summit talks on Saturday, Sept. 9. "Some progress seems to have been made," he said, but "substantial differences" remain. Privately, U.S. officials offered hints of the situation, but under the terms of the news blackout, they spoke in their own diplomatic code.

"Some things we thought would be really tough have turned out to be not so tough, and some things we thought would be easy are turning out not to be," one of them said.

What he meant was this: By the first weekend, the Israelis had shown some "flexibility" on the complex issure of the occupied territory of the West Bank of the Jordan River, considered the key sticking point before the negotiations. That early flexibility suggested the possibility of agreement down the line.

But on the question of removing their settlements from the Sinai - thought not to be a major problem - the Israelis refused to budge.

It was around this time that the summit discussions broke into a two-part effort that would in the end produce two documents - a "framework" for future negotiations involving Egypt, Israel and Jordan over the West Bank, and a "framework" for a separate Egyptian-Israeli peace treaty.

Except for the Sinai settlement issue, American officials discovered, the Egyptians and Israelis were tantalizingly close to the point where they could make peace. But Sadat had sworn to his Arab allies never to sign a separate peace with Isreal. For him to do so at Camp David - he had apparently signaled his willingness to do just that under certain circumstances - he would have to take with him from the summit a "framework" on the West Bank and Gaza that he could at least claim contained significant Israeli concessions.

The rest of the summit focused on an American-directed effort to find the right formula - a "framework" on the West Bank and Gaza that would allow Sadat to sign a separate peace treaty with Israel.

On Sunday, Sept. 10, the three leaders - all smiles, as they always would be in public - toured the nearby Gettysburg battlefield. There were few American aides with the president. They were back in the lodges of Camp David, drafting the first American proposals for the two documents that would finally be produced. By the time it was over, the U.S. delegation would turn out 23 draft documents.

By the second week, the summit settled into a pattern. Carter daily shuttled between the two Middle East leaders, bringing with him the latest American refinements of the last proposals and objections from the one side or the other.

At night, after meeting with either Begin or Sadat, Carter would sit down with Secretary of State Cyrus R. Vance and national security affairs adviser Zbigniew Brzezinski to sort out where it all stood. Then Vance would go over to one of the other cabins where the American drafting team - Assistant Secretary of State Harold Saunders, Ambassador at Large Alfred Atherton and National Security Council staff aide William Quandt - would receive the president's latest instructions for revising the documents and work into the early morning hours.

In the mornings, the U.S. delegation - sometimes including Vice President Mondale, White House political adviser Hamilton Jordan and Powell - met about 7:30 in the President's cabin to review the latest work of the drafting team and plan that day's round of talks. When they looked out the window, they could see Sadat on his early morning walks in the woods.

The pressure was building on all of them. At 4:30 one morning, Rosalynn Carter got out of bed, awakening her husband. Carter's mind turned immediately to the negotiations and he rousted Brzezinski from his cabin to bring a document to Aspen Lodge.

For all of the informality of the Camp David setting, the atmosphere was filled with tension, suspicion, fatigue and what one participant called a "roller coaster" of waves of optimism and pessimism right to the end. Carter was openly discouraged and frustrated at times, but according to his aides, never faltered in pressing the other two men for accommodation.

When Carter would meet with Sadat or Begin alone, there was a considerable amount of what was described as "handholding" of the opposition delegation by the Americans, assuring them that the president "was not giving away the store."

Exhaustion began to take its toll. Watching the movie "An Unmarried Woman," with his wife and Jordan one night, Begin fell asleep.

But at a showing of the World War II movie "Patton," Ezer Weizman put the deliberations going on at Camp David in perspective. After some joking about the irony of a war movie being shown at a peace conference, the Israeli defense minister pointed to the screen and said, "If this thing falls apart, this is what we are going to have - another war."

The crists of the summit came last Thursday. Disgusted with the pace of the talks, Sadat, according to U.S. officials, "sent a signal" of his intention to walk out. It is not known what the signal was, but the next day the Egyptian press was reporting that there had been a "crists" at Camp David and that Sadat was about to leave.

It was after Thursday night, apparently the low point of the summit, that events began to move rapidly. Mondale was summoned to Camp David that night, and the next day he was dispatched for private visits with Begin and Sadat. It was during these meetings that the deadline "to end the summit by Sunday was imposed. And during these meetings, according to sources, Mondale discussed with the two leaders how they would likely look to the world if the then 11-day summit ended in failure.

By the last weekend, three issues remained unresolved, they were Jerusalem, the Sinal settlements and the five-year transitional period during which, according to the final agreement, there will be negotiations "to determine the final status of the West Bank and Gaza and its relationship with its neighbors. . . ."

At some point - when is not clear - an agreement was reached over Jerusalem. It was an agreement to disagree - each side would exchange letters with the other setting forth its position. That issue seemed settled.

The crucial meeting occured Saturday night and lasted until 12:30 Sunday morning. It involved Carter and Vance for the United States, and Begin, Foreign Minister Moshe Dayan and Israeli legal expert Aharon Barak for Israel.

At this meeting, Begin was said to have 'made some movement" on the details of the language governing the five-year transition period for the West Bank and Gaza. It was also at this meeting that the dealock over the Sinai settlements was finally broken - Begin agreed to a formula under which the Israeli Knesset will decide in two weeks whether to evacuate the settlements. For his own domestic political purposes, he did not agree publicly to support withdrawal of the settlements.

Sunday morning at Camp David and it seemed that an agreement, if not peace, was at hand. But then the issue of the holy city erupted once again. Originally, the Israelis proposed that only they and the Egyptians exchange letters stating their positions on Jerusalem, only reluctantly accepting Egyptian demands that there also be a letter stating the American position. The United States has always rejected claims that East Jerusalem - seized from Jordan during the 1967 Arab-Israeli war - is a part of Israel.

The U.S. letter referred to East Jerusalem as "occupied" and Begin strongly objected. It was over that word that the president, photographs, and the latest U.S. draft in hand, held a six-minute meeting with Begin Sunday afternoon. The outcome is still not known, for the letters have not yet been made public.

There was one final meeting involving Carter and Vance for the U.S. Sadat and Undersecretary of State Osama el-Baz for Egypt. After the Egyptians had given final approval to the language dealing with the transition period in the West Bank and Gaza, the president emerged from the meeting and flashed a "thumbs up" sign to his aides.

As they all prepared to leave, a violent storm swept across the Catoctin Mountains. The 13 days of Camp David ended in thunder, lightning and rain.