SAN SALVADOR, NOV. 12 -- Declaring that "the law is the law," a military judge said today that three confessed killers of four U.S. marines and eight civilians would be freed under a sweeping amnesty law that pardons all political crimes.

Two suspected killers of U.S. Lt. Cmdr. Albert Schaufelberger, gunned down May 25, 1983, also were expected to be freed under the amnesty, judicial sources said. The case against a top military officer implicated in the 1983 killings of at least 19 civilians also was closed, an official said.

The decisions close some of the most famous cases in El Salvador's eight-year-old civil war, which has claimed about 61,000 lives in the fighting and related political violence.

On Nov. 5, President Jose Napoleon Duarte put into effect a sweeping amnesty law pardoning "political" crimes committed as a result of the civil war.

Under the law, enacted in compliance with a regional peace pact, cases must undergo judicial review to determine whether they are covered by the amnesty. So far, 427 prisoners have been freed.

"It has been determined the killings were political crimes, and they will go free today under the amnesty law," said Military Judge Jorge Alberto Serrano, who presided over a review of the case. "The killings are reprehensible here or anywhere, but the law is the law, and we must apply the amnesty."

Serrano turned over his release order for Abraham Dimas Aguilar, Juan Miguel Garcia and William Celio Rivas to the head of Mariona Prison, five miles north of the capital. Sources said the three men were expected to leave the prison after paperwork was completed.

On June 19, 1985, the three rebel gunmen opened fire on two outdoor cafes in the exclusive "Pink Zone" in the capital.

Four off-duty marines assigned to guard the U.S. Embassy were killed along with two American computer technicians, five Salvadorans, a Guatemalan and a Chilean. One rebel was accidently killed by his own men.

The rebels, who said they belonged to the hard-line Revolutionary Party of Central American Workers, confessed to the slayings and said the marines were the targets of the attack. The men have never been tried for the killings.

A U.S. statement said, "We understand and respect President Duarte's desire to offer the broadest possible amnesty in the spirit of national reconciliation under the terms of the {peace} agreement.

"As a matter of policy, we believe those responsible on both the left and the right for terrorist actions or crimes against U.S. citizens should not be allowed to escape justice."