Official crime. Lawmen accused of breaking the law. It is a pheonomenon with which the nation is unfamiliar and uncomfortable.

But in recent months it has happened. America's long-revered protective agencies, the CIA and the FBI, have been the targets themselves of criminal Investigations.

And ironically, those accused have warned that they might be compelled to disclose at trial the very national secrets they were charged with protecting.

Attorney General Griffin B. Bell, the former judge who inherited the cases from his preducessor, has stuggled with the conflicting issues:

His duty to uphold the law; the concern for guarding national secrets: the morale of an intelligence community already tarnished in recent years by congressional revelations about its abuses of the rights of American citizens.

The Central Intelligence Agency case, which focused on former Director Richard M. Helms, was resolved recently when Helms accepted a government plea-bargain offer designed to head off the risks of a trial where national security and secrets were sure to be raised as a defense.

The continuing probe of the Federal Bureau of Investigation, which has resulted so far only in the indictment of former New York supervisor John J. Kearney - for directing a mail opening and wiretap operation against radical fugitives - is now the focus of attention.

The arguments in the FBI investigation are all too familiar to Bell and his prosecutors. For though the Helms case was settled first, the key elements which decided it - national security and plea bargaining - were presented first with Kearney, and seem to have affected the Helms outcome in important ways.

For instance, federal prosecutors offered to let Kearney plead to misdemeanor civil rights violation charges for his part in the campaign against the Weather Underground.

He refused and was indicted in April on five felony counts in connection with directing a mail-opening and wiretapping operation.

High Justice Department officials involved in the case said in recent interviews that they felt Kearney rejected the plea-bargain offer because he didn't believe the Justice Department would seek an indictment.

"After all, we'd never indicted an FBI official before," one of the officials said.

They also believe that the precedent set by the Kearney indictment was a message to Helms that he too would be indicted if he rejected a plea-bargain offer.

The same officials also acknowledge that the sweeping pre-trial discovery allowed in preparation for Kearney's defense weighed on their consideration of the Helms case.

Edward Bennett Williams, the defense lawyer for Helms and Kearney clearly intends to use "national security" as a key part of the defense strategy in the Kearney trial, court records filed so far indicate.

Using pre-trial discovery as a sort of legal terror weapon, Williams has been granted access to documents bearing on similar conduct as far back as World War II.

One goal seems to be find documents which would link the Weather Underground to foreign countries and thus set up a national security justification for the wiretaps and break-ins.

The FBI went so far last year as to prepare an after-the-fact "top secret" report outlining ties between the Weather Underground and Cuba, as a way to show the American radicals were agents of a foreign power. The report was compiled after the Justice Department began its investigation of Kearney and other FBI officials involved in authorizing or carrying out the campaign against the Weather Underground.

Benjamin R. Civiletti, the head of the department's Criminal Division, has said that he doesn't consider national security to be a valid defense in the Kearney case. "The risks to national security in this case were ephemeral," he said.

But he has said before that he and Bell were concerned that Williams would attempt the same kind of sweeping discovery in the Helms case, which was much more likely to turn up national secrets.

If a judge then ruled that such classified material was needed in a trial. Bell said in a recent press conference, the government might have to decide to "abort" the case in mid-trial to protect the secrets.

Civiletti told reporters at a recent breakfast meeting that a federal grand jury in Washington has been trying to determine whether Kearney's superiors in FBI headquarters authorized the break-ins and wiretaps.

He declined to say whether there would be further indictments. But he left open the possibility of a Helms-type resolution in the Kearney case or any further prosecutions.

Certainly the government would be willing to discuss any appropriate, sound disposition in any case," he said.

Civiletti said there was no plea bargaining going on now in any of the possible FBI cases.

He also said he was unsure how the death Wednesday of former FBI Assistant Director William C. Sullivan might affect the Kearney case. Sullivan appeared before the grand jury in Washington in August.

One source close to Sullivan said that the longtime top aide to FBI Director J. Edgar Hoover had told others that he passed along to Kearney an oral directive that there should be "no holds barred" in investigating the Weather Underground.

This is believed to have been shortly after the radical group took credit for bombing the U.S. Capitol in March, 1971.

Sullivan thus was certain to have been called as a defense witness to testify that Kearney's alleged illegal actions had been authorized.

Justice Department officials note that there are key factual differences in the Helms and Kearney type cases. While Helms was being investigated for two instances of allegedly lying to a Senate committee, the FBI cases also involve alleged violations of the rights of American citizens.

This latter issue has become a complicating factor in the Kearney case because civil suits have been filed against Kearney and other FBI officials by persons who were subject to the mail-opening, wiretaps, and break-ins.

Two weeks ago, for example, U.S. District Court Judge Charles S. Haight Jr. of New York postponed civil discovery in a suit where Kearney is one of the defendants.

The judge noted in his order that the criminal case against Kearney was one "of great public moment and possibly of considerable historical importance."

Thus he said, civil discovery posed risks to the Justice Department's ongoing criminal investigation and to the security precautions the criminal trial judge had taken in ordering that documents be presented under seal and that attorneys have secrecy clearances.