Deputies sweeping through the Alexandria jail last fall came across an odd-looking collection of papers held together by two toilet paper tubes and a pen. They appeared to be written in code.

When the deputies confronted the prisoner in the cell -- Brian P. Regan, a former Air Force intelligence analyst with the highest security clearance -- he flushed the papers down the toilet.

Less than a month later, the jailers discovered more items Regan wasn't supposed to have: a map of a park indicating where items were buried and letters to his wife and family accompanied by a page of coded numbers and letters interspersed with superscripts.

Regan wrote those letters -- which also were encrypted -- at the federal courthouse in Alexandria while preparing to go on trial for espionage. In fact, they were written on a computer paid for by the same U.S. attorney's office that was prosecuting him.

Some of the FBI's best encryption experts are just now cracking the code on those documents and that computer.

"There is probable cause to believe that the documents may contain coded messages, which have not yet been decoded," an alarmed federal judge said last month in issuing an order sealing those documents forever. The documents, the judge said, "may reveal the location of classified national security information, which if they reached the intended recipients may harm" the country.

The bizarre series of jailhouse incidents, revealed in newly unsealed court records, is unexplained and adds to the enduring mystery of convicted spy Brian Patrick Regan.

One month after he accepted a life sentence for trying to spy for Saddam Hussein, Regan remains, in many ways, the spy who flew under the radar. His case never generated the headlines of more storied espionage defendants, such as Robert P. Hanssen, and his crimes -- trying to sell secrets to Iraq and China but not quite succeeding -- seemed almost shabby by comparison. His own attorneys portrayed him as an odd and bumbling loner, an impression shared by some of his co-workers at the National Reconnaissance Office in Chantilly.

Yet those same workers say Regan was much smarter than he appeared. And as federal agents debrief Regan in prison, they are still assessing the damage he caused -- and could have caused -- to national security.

"It was a very serious case," said Van Harp, head of the FBI's Washington Field Office, whose agents investigated Regan.

Jonathan Shapiro, one of Regan's defense attorneys, characterized Regan's espionage as "never anything more than an attempt, which was doomed to failure from the start." He called the concerns about Regan's behavior in jail "much ado about nothing."

U.S. Attorney Paul J. McNulty, whose office prosecuted the case, cautions that though "Regan's actions were extremely serious and potentially very damaging, this is a case of the attempt to engage in espionage."

Yet McNulty's own prosecutors have said in court documents that they suspect Regan removed "far more" than the 800 pages of classified documents he admits stealing and that he may have buried documents at various secret locations. And everyone from the FBI's cryptanalysis group to other intelligence agencies are only now breaking the code in the letters found in Regan's cell and on some of the documents Regan was carrying in a fan-shaped folder when he was arrested in August 2001. The government has learned enough to say that the letters to Regan's family refer to "buried items."

Where those items are buried and what they might contain remain a mystery. Since Regan's security clearance was above top secret, the range of sensitive materials he had access to is breathtaking, officials say.

Adding to the mystery of what is the question of why. Why would a father of four from suburban Maryland, a military lifer who enlisted right out of high school, betray the country he served for two decades?

Clues can be found in the trial testimony, in which prosecutors said Regan faced more than $100,000 in debt and defense attorneys called him a James Bond wannabe with an active fantasy life. Former co-workers and neighbors add another element, describing a reclusive man who complained frequently about his job and station in life.

Those explanations don't quite work for some. "What was the ultimate motivation here?" said one law enforcement official. "That's still not known."

Even his wife is at a loss. "I don't know anything about this. I never did," Anette Regan said in a brief interview in the toy-strewn yard of the small brick house in Bowie where she is raising the couple's four children alone.

"I can't even talk to him about it when I visit him," she said. Anette Regan was under investigation for obstruction of justice for allegedly helping Regan cover up his actions. The government agreed not to prosecute her if Regan accepted the life sentence and cooperated.

"I don't think the investigating in this case is over," she said before cryptically adding that more "digging" needed to be done.

Regan, 40, was convicted in February of trying to sell classified documents to Iraq and China and of gathering national defense information. He was acquitted of trying to spy for Libya.

Prosecutors argued all along that Regan had done major damage to national security and tried to make him the first espionage defendant executed in the United States in half a century. Defense attorneys objected to the death penalty, saying that more renowned spies, such as the FBI's Hanssen and the CIA's Harold J. Nicholson, did not face execution even though they committed actual espionage.

The jury determined that Regan's crimes did not rise to a capital offense. In a sudden deal with prosecutors, Regan agreed to the life term last month. Speaking in a hushed voice, he told U.S. District Judge Gerald Bruce Lee that he was accepting the sentence, with no chance of parole, to stop the government from prosecuting his wife.

Regan, who also told the judge he was taking antipsychotic medication and Prozac for depression, said he did not discuss his decision with Anette.

Little is known about the imprisoned spy. Born in Queens, N.Y., Regan enlisted in the Air Force in August 1980 and served until he retired Aug. 31, 2000.

From 1991 to 1994, Regan was assigned to the Air Force Intelligence Support Group at the Pentagon. A former colleague recalls his complaining about everything from his job to his work hours. "He thought he wasn't being appreciated," the former co-worker said.

Regan hinted at the dissatisfaction in a letter he would write to Hussein that was featured prominently at his trial. "I feel that I deserve more than the small pension I will receive for all of the years of service," he wrote in seeking $13 million for highly classified information. "There are many people from movie stars to athletes in the U.S. who are receiving tens of millions of dollars a year for their trivial contributions."

As a career noncommissioned officer, the highest rank Regan could have achieved was chief master sergeant. He never rose above master sergeant, two levels below that. Regan's final Air Force salary was about $50,000 a year, including a housing allowance.

In 1993, the Regans spent $115,900 on the house in Bowie, property records show. Neighbors describe Brian Regan as a loner who was frequently away on business. "He was not one of those handy-dandy kind of guys who would come out and help when it snowed," said one neighbor, who spoke on condition of anonymity.

Colleagues at the National Reconnaissance Office, where Regan began working in 1995, recall a similarly quiet demeanor. Regan and his family rarely socialized. He spent most of his after-hours energy weightlifting at the office gym.

"He was this big lumbering guy, and he didn't open his mouth a lot," a colleague said.

But that wasn't the whole story. One day when Regan spoke in front of a large group, "he really knew his stuff, and the way he was talking, I suddenly realized he was smarter than this image he gave off," the colleague said. "He was like two different guys."

At the NRO, which oversees operation and construction of the nation's reconnaissance satellites, Regan's specialty was signals intelligence -- analyzing radio frequencies and other signals emitted from enemy radar or surface-to-air missiles and helping U.S. forces evade them. With the highest security clearance -- top secret plus an additional level of clearance known as Sensitive Compartmented Information -- Regan had access to details about everything from nuclear weapons and early warning systems to chemical and biological weapons facilities. In his letter to Hussein, Regan bragged that he could see documents from every U.S. intelligence agency, which was confirmed by law enforcement sources.

After his retirement from the Air Force, Regan was hired by defense contractor TRW Inc. and resumed work for it at the reconnaissance office July 30, 2001. By that time, the FBI had started daily surveillance, according to trial testimony.

Regan drew the attention of investigators after the United States learned that an unnamed country had obtained classified U.S. documents and that officials from that country had received encrypted messages telling them to contact a free e-mail account under the name "Steve Jacobs." FBI agents determined that the Jacobs account had been accessed from public libraries in Crofton, Falls Church and Prince George's County. The two Maryland libraries are within five miles of Regan's home; the Falls Church library was on his commuting route.

In August 2001, Regan was arrested at Dulles International Airport as he boarded a plane to Switzerland. He was carrying the encrypted coordinates for a Chinese missile site and an Iraqi surface-to-air missile site, along with the phone numbers of Iraqi and Chinese embassies in Europe.

Last month, Judge Lee allowed the government to view the copied contents of Regan's hard drive and said the letters to his wife and children and the coded document must be sealed forever.

Officials would not say what else has been found on Regan's hard drive and whether any wayward classified information has been located.

Regan and the FBI are locked in the painstaking debriefing process. Even that has been difficult. "It's a challenge to get the information. It doesn't just come flowing forth," one government official said. "You are asking someone who is removed in terms of time sequence from that part of his life, and he has to recall things. . . . But over time, it works out."

Brian P. Regan is in prison for life without the possibility of parole for his attempts to sell highly classified material to other governments.