AT THE HEIGHT of the Cuban missile crisis in October 1962, a key Soviet surface-to-air missile base on the island was attacked, apparently by Cuban troops, with at least 18 Soviet casualties, according to newly-available decoded communications intercepts.

Less than 12 hours later, on the morning of Oct. 27, 1962, an American U-2 spyplane crashed near the base. President Kennedy and his advisers, who did not know of the firefight at the Cuban base, assumed the U-2 had been shot down by a Soviet-directed missile from that base.

The military battle in Cuba, which becameknown only when the United States broke a Soviet code in 1964, suggests that during the missile crisis Soviet Premier Nikita S. Khrushchev may not have had complete control of the SAM battery that shot down the U-2. If so, the Cuban missile crisis was even more dangerous than the public has realized -- with the Cubans acting independently of Moscow and both superpowers making strategic misjudgments.

The Kennedy administration made its critical misjudgment about the U-2 shootdown, one of the most emotional issues of the crisis, by assuming that Khrushchev had direct control of all surface-to-air missile batteries in Cuba and had ordered the shootdown -- perhaps to deliberately escalate the crisis. It was the first known use of a Soviet surface-to-air missile in the crisis, and senior White House officials did not consider the possibility that it had been a Cuban decision to shoot down the plane.

The U-2 shootdown was a factor in President Kennedy's decision to send his brother Robert to see Soviet Ambassador Anatoly Dobrynin on the evening of Oct. 27, according to Robert Kennedy's posthumous memoir. The younger Kennedy carried a tough ultimatum: The Soviets should begin dismantling the missiles within 48 hours or the United States would strike. Khrushchev caved in overnight and agreed to an immediate withdrawal of the Soviet nuclear missiles in Cuba in return for a private American commitment to remove Jupiter missiles within five months from Turkey and Italy, as well as a public pledge not to invade Cuba.

That Saturday, Oct. 27, was described by Harvard professor Graham T. Allison in his classic 1971 study of the crisis, "Essence of Decision," as "the blackest and most frustrating day of the crisis." New details will emerge soon, when Harvard University releases a previously classified transcript of the Oct. 27 meetings of President Kennedy's missile-crisis management group known as the Executive Committee, or "ExComm."

The ExComm minutes will show that Kennedy was more willing than many of his advisers to compromise over withdrawal of American missiles from Turkey than previously thought. Kennedy wondered on Oct. 27 how he could justify risking a nuclear war over the details of withdrawing missiles from Turkey that his own advisers considered obsolete. The minutes also show that ExComm members, in their discussions that day, all assumed that Khrushchev had authorized the U-2 shootdown as a show of force designed to buttress his bargaining strategy -- or had been forced to take this action by hardliners in the Soviet Union.

Word of the U-2 shootdown came late in the morning on Oct. 27, just moments after the White House learned that Khrushchev had toughened his demands for a settlement of the crisis by insisting in a letter to Kennedy that any withdrawal of Soviet missiles in Cuba be publicly linked to the withdrawal of American missiles from Turkey. In a note received by the White House the evening before, Khrushchev had offered to withdraw the missiles from Cuba without any such linkage.

The ExComm minutes show that President Kennedy expressed concern that the U-2 shootdown might be "an escalation" on the part of Khrushchev, according to those who have read the transcript. It was the first known use of a Soviet SA-2 missile in Cuba since the crisis began. There also were reports that Cuban anti-aircraft batteries had opened fire on two low-flying American reconnaissance aircraft, without causing serious damage, and there were questions in the ExComm, according to the minutes, about the extent of Khrushchev's control over the anti-aircraft.

The aircraft was piloted, as many in the ExComm knew, by Air Force Maj. Rudolph Anderson Jr., whose flight two weeks before had been the first to bring back photographic evidence of the Soviet missile installations.

The first challenge to American assumptions about the U-2 shootdown came about 18 months later, in early 1964, when analysts at the National Security Agency succeeded in breaking a Soviet code. The Soviet code system, known to some in the American intelligence community as "Silver," had been in widespread usage by Soviet forces stationed in Cuba in 1962.

As the NSA analysts began decoding some of the many messages sent during the crisis, they learned that there had been a major firefight on the night of Oct. 26 at Los Angeles, a SAM site near a naval base at Banes, on Cuba's northeastern coast -- which was the site of the next morning's U-2 crash.

The Soviet commander at the Banes base was overheard saying that there had been an attack at the adjacent SAM base. He subsequently reported that he was advancing with troops and that three soldiers were killed and 15 other were wounded. The commander, identified by the NSA as an officer named Mal'tsev, also issued a call for surgeons. Seven physicians were sent to the scene that night.

Other NSA intercepts showed that Mal'tsev, whose "advance" was apparently a counterattack against Cuban troops seeking to storm the SAM base, was ordered to make a full report in person the next morning, Oct. 27, to Colonel General of Aviation Victor Davidkow, apparently the senior Soviet commander at the time in Cuba.

The intercepts, which made clear that Soviet soldiers had been "shot and wounded," did not specifically name the attacking forces as Cuban, although NSA analysts quickly reached the obvious conclusion that the fighting was between Soviets and Cubans. The intercepts suggested that the attack had ended by the morning of Oct. 27, but the NSA analysts were unable to preclude the possibility that the SAM site at Los Angeles may not have been fully under Soviet control when the U-2 was shot down the next morning.

Other evidence supported the analysts' assumption. By early 1964, according to a former official who was at the top of an intelligence agency at the time, there was clear evidence that the Cuban military -- and thus Fidel Castro -- had been in direct control of the many antiaircraft batteries scattered throughout the island at the height of the crisis. The official recalled that his agency eventually concluded that the SA-2 SAM sites had been "manned by a mixed crew of Cubans and Russians" as of Oct. 27. Furthermore, he said, there was no available evidence linking Khrushchev to an order to shoot down Maj. Anderson's U-2.

"We'll never know whether it was shot down by Cubans or Russians," the official added. "I doubt even if Castro knows."

Cuban accounts of the crisis are contradictory. An American who recently visisted Havana said that a senior Cuban official had told him that he had no knowledge of a firefight at the Los Angeles SAM site in October 1962. If such an incident took place, he said, it could have been Russians fighting Russians. However, an American professor said in an interview last week that during a research trip to Cuba several years ago, he had been told that that the Cubans indeed had taken over a Soviet military base by force during the Cuban missile crisis.

None of these insights was available to the ExComm on the morning of Oct. 27. Nonetheless, the intelligence official said, he found it disturbing that the senior members of the ExComm acted without full knowledge in assuming that Khrushchev was responsible for the shootdown: "I don't think you'll ever know who pulled the trigger."

The highly classified communications intelligence, with its implication that policy makers had made a serious miscalculation during the missile crisis 18 months earlier, was kept under tight wraps inside the National Security Agency. Conversations in recent weeks with former members of the ExComm, including McGeorge Bundy, Kennedy's national security adviser, indicated that none of the key Kennedy administration actors in the missile crisis had been briefed on the new material in 1964.

The report of the firefight at Banes apparently did not surface again until 1979, when William B. Bader, an assistant deputy undersecretary of defense for policy, initiated an exhaustive study on Soviet forces in Cuba. The Carter administration was then in the embarrassing position of having called public attention to the so-called Soviet "brigade" in Cuba only to learn that it had been in place since the resolution of the missile crisis, which hinged in part on a pledge by the Kennedy administration not to invade the island.

Bader, in a recent interview, recalled asking the intelligence community in 1979 for all of its files on Soviet forces in Cuba. The documents included a bonus: the electronic intelligence about the battle at Banes. "What I saw was a summary talking about a firefight inside Cuba," he said. "It did have date and time groups but the significance of it didn't occur to me at the time." His focus then was to unravel the 1962 and 1970 agreements that permitted the Soviets to keep troops inside Cuba: "I saw that material in context of the brigade issue."

Bader, who is now a vice president of the SRI International, a Washington think tank, only realized much later the significance of the 1964 intelligence report. "This raises an important question," he said. "How is raw intelligence -- especially of an exotic variety -- used or abused in the system? Why didn't the intelligence community at the time make the connection? Why didn't they appreciate the significant burden of it?"

One government official who did understand the strategic significance of the intercepts in 1964 was Daniel Ellsberg, then a consultant from the Rand Corporation at work on a highly classified study for the Johnson administration of crisis communications during the Cuban missile crisis. Ellsberg would burst into fame seven years later as the man who made public the top-secret Pentagon Papers. But he didn't disclose his special knowledge of the missile crisis until April 1986, when he was interviewed by WGBH, the Boston public television station, for a documentary on the Cuban missile crisis to be aired in 1989.

According to a transcript of Ellsberg's interview, he recalled that the Los Angeles site had been under ground attack on Oct. 26, apparently by Cubans, with a fierce Soviet counterattack.

"Precisely whose finger was on the button" when the U-2 was shot down the next morning "is not known," Ellsberg added. "But the fact that the Soviets had lost military control of the site is knowable at this point although. . .no one knew that on the U.S. side at the time."

Ellsberg did not mention in the television interview that his information about the firefight came from communications intercepts. In addition, only a few of the scores of books and academic studies on the missile crisis have raised any doubts as to the extent of Khrushchev's control over the SAM sites in Cuba, and the few doubters invariably suggested that the downing of the U-2 had been ordered behind Khrushchev's back by dissident military men inside the Soviet Union.

Ellsberg, informed in recent weeks that a reporter had obtained independent corroboration for his account of the firefight at Banes, told more of the story. His crisis-communications study, which was undertaken for W. Walt Rostow, then the State Department counselor, gave him enormous access to America's most closely held secrets as well as to members of the ExComm. Ellsberg also had been deeply involved in the missile crisis in 1962, working with a group planning the Cuban air strikes.

Among those interviewed by Ellsberg in early 1964 was Robert Kennedy, who told of his extraordinary meeting with Dobrynin on the evening of Oct. 27, after the U-2 shootdown. That meeting also came after the receipt of Khrushchev's letter in which he demanded that the Jupiter missiles be pulled out, with an official announcement, as part of a settlement.

Kennedy, obviously aware that his remarks were meant only for a highly classified internal government study, told Ellsberg of his ultimatum to Dobrynin. That ultimatum would not become publicly known until Kennedy's posthumous memoir of the crisis, "Thirteen Days," which was published in 1969. In essence, the Soviets were told that the United States would attack the missile sites inside Cuba by Tuesday morning unless there was some evidence within the next 48 hours that the sites were being dismantled. Soviet officials already had learned that American planning for a full-scale invasion was underway, with D-Day set for early Tuesday morning, October 30.

Ellsberg recalled that he asked Kennedy: "'So they had 48 hours to decide and if no dismantling is under way, then we'll hit the misssile sites and follow up with an invasion.' Bobby interjected 'Unless they hit another reconnaissance plane and in that case, we will hit all the SAM sites immediately and probably the missile sites as well.'" More reconnaissance flights were scheduled for the next morning. Kennedy was specific, Ellsberg said, in recalling that he had told Dobrynin he had 48 hours to act.

In "Thirteen Days," Kennedy described his tough conversation with Dobrynin this way: The shooting down of the U-2 was "a most serious turn of events," he quoted himself as telling the Soviet ambassador. "Because of the deception of the Soviet Union, our photographic reconnaissance planes would have to continue to fly over Cuba, and if the Cubans or Soviets shot at these planes, then we would have to shoot back. This would inevitably lead to further incidents and to escalation of the conflict, the implications of which were very grave indeed." Kennedy was assuming that that Khrushchev had control not only over the SAM sites in Cuba but also over the many antiaircraft batteries there, including those gun emplacement that had fired on the two low-flying American reconnaissance planes on the morning of the 27th.

In Ellsberg's view, Khrushchev understood what Kennedy did not -- that he, and perhaps even Fidel Castro, could not stop the firing of the antiaircraft batteries.

"Bobby had no reason to believe that the threat on reconnaissance {to Dobrynin} had any special significance," Ellsberg recalled. "He didn't think it was that important. He had no reason to believe that Khrushchev was going to be so reckless as to shoot anything else down. It didn't occur to him that he was talking to the wrong nation -- and that Khrushchev did not control the Cubans."

That fact also didn't occur to Ellsberg -- until he was informed on April 14, 1964, about a month after his meeting with Kennedy, of the new intelligence finding.

"Once I learned about the firefight at Los Angeles," Ellsberg recalled, "I said, 'Jesus Christ.' Khrushchev didn't have control and that's why he backed off right away" -- within 12 hours instead of taking the next 48 hours and attempting to improve his bargaining positon. Khrushchev knew that the United States would send more reconnaissance flights at first light the next morning and he also knew, Ellsberg theorized, that he could not guarantee that the Cubans manning the antiaircraft guns -- and perhaps the SAM site at Los Angeles -- would not shoot down another aircraft and precipitate an immediate American response.

Castro, in an interview with journalist Tad Szulc published last year, acknowledged that on Oct. 27 he had given his anti-aircraft forces blanket authority to shoot at low-flying American reconnaissance planes. Only "the inexperience of our artillerymen," he said, led them to miss that day. "I am absolutely certain that if the low-level flights had been reesumed {on Oct. 28}, we would have shot down one, two, or three of the planes," Castro said. "I don't know whether this would have started nuclear war."

The risks were greater than anyone in Washington realized.

Other Cuban missile crisis scholars, most notably Ambassador Raymond L. Garthoff, confirmed in recent interviews that the private record shows that Robert Kennedy did warn Dobyrnin about reconnaisance flights in their Oct. 27 meeting. Garthoff, who wrote many key memoranda during the crisis as a young State Department officer, reports new details about the extent of Soviet-Cuban estrangement in his new book on the missile crisis, which will be published later this month. After Khrushchev's backdown, he writes, "Cuban troops took up positions around the four Soviet missile bases on Oct. 28 and remained there for three days . . . . This fact was not immediately known."

As his research continued, Ellsberg said, he found further evidence of Khrushchev's lack of control, ignored at the time, in the as-yet-unpublished telephone records of Secretary of State Dean Rusk. Ellsberg was provided with full access to all of the secretary's telephone logs and memoranda, and uncovered two extraordinary telephone calls in which United Nations Secretary General U Thant reported on his visit to Cuba in late October, just after Khrushchev had agreed to dismantle the nuclear missiles.

The first telephone message, dated Oct. 31, was from Adlai Stevenson, the American ambasssador to the United Nations, who relayed U Thant's account of a meeting on Oct. 30 in Havana with the Soviet ambassador and a young brigadier general, identified as Igor Statsenko, who introduced himself as the commander of Soviet forces in Cuba. U Thant quoted the officer, according to Stevenson, as explaining that all of the antiaircraft weaponry and SAM sites on Cuba are "manned by Cubans. It was a Cuban colonel that shot down our plane."

Statsenko's statement to Thant suggested, as Ellsberg understood, that the Cubans were manning the SAM sites as of Oct. 30, three days after the only known firing of a SA-2 SAM missile had taken place. Since it was highly improbable that the Soviets would turn over control of the SAM sites to the Cubans after the U-2 had been shot down and after Khurshchev had agreed to no longer attack American reconnaissance aircraft, Statsenko's comment seemed to mean that the Soviets had permitted the Cubans to operate the SAM sites at least since the 27th, even if a Soviet officer was on the scene and nominally in charge.

Senior American intelligence officials, in recent interviews, confirmed that the United States did not know during the crisis precisely when the SA-2 sites had become fully operational in Cuba.

The second telephone message to Rusk discovered by Ellsberg came from George Ball, the undersecretary of state, who reported Nov. 1 on a conversation he had with Thant's military adviser, Indian Gen. Indar Jit Rikhye. Rikhye described a conversation with Fidel Castro in which the Cuban premier was quoted, as relayed by Ball, as saying that "Castro talked as though he had all the anti-aircraft and he did boast that it was the Cubans who had shot down Major Anderson. Rikhye himself is not at all persuaded," Ball told Rusk on the telephone, "that this was just only boastfulness on his {Castro's} part."

Dean Rusk and other members of the ExComm thus had been provided with evidence within days of the shootdown from both the Cubans and the Soviets in Cuba that the U-2 probably had not been attacked on orders from Khrushchev. But the senior officials could not see the significance of the information because everyone in the government assumed that the spyplane had been shot down by a Soviet SA-2 missile in the control of the Soviet forces on the ground -- and thus by Khrushchev.

Castro himself has since provided varying accounts of who was in control, telling a Washington Post reporter during an interview in 1985, for example, that Soviet troops had been manning the SA-2 missiles when the U-2 was shot down. "I did not have the honor of shooting down the spy plane," Castro said.

The strong assumption of Soviet control inside Cuba made it inevitable that the information provided by U Thant and his military adviser also would be overlooked throughout the intelligence community, although senior American intelligence officials, in interviews in recent weeks, acknowledged that the United States government had no hard information as of Nov. 1, 1962, as to how Major Anderson's aircraft had been destroyed.

George Ball, in a telephone interview from his office in Princeton, N.J., confirmed that he had held a conversation with Rikhye. Told of the intelligence suggesting that Khrushchev had not controlled the U-2 shootdown, Ball said he had not been told of the 1964 intercepts but acknowledged that he "was not surprised." Throughout the crisis, he said, the ExComm was constantly making assumptions about Soviet behavior: "We were making guesses and we were just plain wrong -- and we were tapping what we thought was the best possible intelligence."

Seymour Hersh is a Pulitzer Prize-winning journalist and author of "The Target Is Destroyed."