A civilian court convicted and sentenced an ex-president, Army Gen. Jorge Videla, and junta member Adm. Emilio Massera to life imprisonment today for leading Argentina's undeclared war on left-wing guerrillas, in which about 9,000 persons disappeared during the 1970s.

But in other rulings that drew protests from human rights activists and leftist politicians, the six-judge federal appeals panel issued jail terms of 4 1/2 to 17 years to three other ex-junta members and acquitted four more.

The long-awaited judgment against the three sets of military leaders that ruled Argentina from 1976 to 1982 marked the first time in recent history that Latin American military leaders have been sentenced by a civilian court for serious crimes. Peaceful transitions from military regimes commonly have been accompanied by explicit or tacit promises of immunity for the generals. President Raul Alfonsin ordered the trial soon after he was elected two years ago.

Shortly before the verdict was read this afternoon, the government lifted a state of siege imposed Oct. 25 to quell a wave of bomb explosions and menacing phone calls that disturbed a congressional election period. The violence, widely attributed to right-wing paramilitary cells opposed to the trial, has since abated. Alfonsin's Radical Civic Union won the Nov. 3 elections comfortably.

The end of the state of siege came 11 days before the statutory 60-day expiration and one day ahead of Alfonsin's second anniversary in office. Interior Minister Antonio Troccoli said lifting of the measure meant that orders to detain six military officers and six civilians, suspected of plotting against the state, would be canceled.

Three of the suspects never were located, and three others sought shelter in Paraguay or Uruguay, taking advantage of a constitutional provision that allows people sought under a state of siege to leave the country.

Several hundred people -- including government officials, human rights activists, reporters and other invited guests -- packed the two-story-high courtroom. Midway through the reading of the sentences by court president Leon Arslanian, human rights leader Hebe de Bonafini donned a white head scarf in protest and was escorted from the courtroom.

The scarf is a symbol of the group Bonafini chairs, the Mothers of Plaza de Mayo, an organization of relatives of those who disappeared during what is now commonly called Argentina's "dirty war."

Army Gen. Roberto Viola, who succeeded Videla as president in 1981, was given a 17-year jail term. Adm. Armando Lambruschini, Navy commander from 1978 to 1981, received 8 years in prison. Former Air Force commander Orlando Agosti received a 4 1/2-year sentence.

Cleared of all charges were Brig. Gen. Omar Graffigna, who was Air Force commander in the first junta, and the three military rulers during the 1982 Falkland Islands war against Britain -- Army Gen. Leopoldo Galtieri, Adm. Jorge Anaya and Air Force Brig. Gen. Basilio Lami Dozo. The three still face charges before a military court for Argentina's defeat in the South Atlantic conflict.

The court ordered the five ex-commanders who were found guilty to be stripped of their rank.

Only one defendant, Graffigna -- the sole accused not in detention -- was present. Under military law, jailed defendants are not obliged to appear on the day of sentencing. The civil court continued the trial under military law after a court-martial failed to pursue the case. Attorneys for Videla and Massera said they would file appeals with the Supreme Court.

Throughout the trial, the former military commanders remained unrepentant about the murders, tortures, abductions, extortions and other crimes with which they had been charged. In closing statements in October, they took pride in their defeat of leftist guerrillas, saying the antiterrorist campaign was an irregular war that demanded unconventional methods.

"We discarded the justifications put forward by the defense," said the six-judge panel in its ruling, "because although the need to repress the terrorist bands was known, the repression and combat should never have gone outside the framework of the law."

The judges said the military commanders could have used other methods against the guerrillas, citing the juntas' legal authority then to declare emergency zones, dictate summary judgments and even deliver death sentences.

The judges said that after studying national and international literature on war and subversion, "we have not found a single rule which justifies or in any case might excuse the authors of the crimes which have been set out in this trial."

The trial began April 22 this year. The last testimony was heard Oct. 21, after about 1,000 witnesses had been called.

Federal prosecutor Julio Strassera had requested life imprisonment for five of the retired officers -- Videla, Massera, Agosti, Viola and Lambruschini -- and jail terms of 10 to 15 years for the rest, plus a stripping of rank for all.

The arguments of the ex-commanders apparently also failed to persuade most Argentines. More than 90 percent of those responding in recent opinion surveys were recorded as having favored bringing the onetime commanders to justice.

The trial's highly charged testimony opened the eyes of many here to what had taken place during the secret war. At the time there were many who suspected what was going on but few who were willing to confront the issue.

The trial also has deepened alienation and anger in the ranks of active and retired military personnel, who also have expressed resentment against the Alfonsin administration for sharply cutting the armed forces budget and holding down military salaries.

In percent of gross national product, Argentina's military spending is now put at half what it was in 1983 and about equal to its level before the armed forces took power in 1976.

Many in the military and in civilian conservative circles have been hoping that with the close of the trial of the nine ex-commanders, cases pending against hundreds of lower-ranking officers also accused of involvement would be dropped.

Proponents of an amnesty argue that the human rights issue must not be allowed to continue to alienate the military from the rest of Argentine society. But human rights activists insist the judicial process must run its course if democracy here is to be strengthened.

In a statement which those opposed to an amnesty saw as encouraging, the court said it would forward its voluminous findings to the Supreme Military Council to help in cases against "superior officers who occupied zone and subzone commands during the fight against subversion and all those who had operative responsibility during those actions."

But the verdict said nothing about the controversial principle of "due obedience," on which hinges the defense of lower-ranking officers who claim to have only been following orders in hunting down guerrillas and dissidents.

Alfonsin has said officers who committed "excesses" should be judged more harshly than those who simply obeyed orders.

[Argentine Vice President Victor Martinez, visiting in Washington, said his government's primary objective "was achieved -- which was that a totally independent court could make its own decision." He said his government was preparing no general amnesty for military men, "at least until all are tried. To do so, would be laughing at the justice system."]