Inside a Rockville laboratory, a team of scientists labored in round-the-clock shifts to do something many colleagues thought impossible: decode the genetic “fingerprint” of a deadly anthrax sample to help the FBI solve a case.

The researchers had been swept into Amerithrax, the massive federal investigation into the 2001 anthrax mailings, and they yearned for a breakthrough. But finding unique markers in the organism’s vast genetic code was a long shot.

The big break came in a small package: tiny test tubes, delivered by the FBI, from a military lab at Fort Detrick in Frederick, where lab workers had spotted a series of odd-looking bacteria colonies. Those oddities would help the Rockville scientists decipher the genetic signature of the anthrax used in the nation’s most serious bioterror attack.

Earlier this year, the Proceedings of the National Academy of Sciences published the first thorough account of the research that was key to solving the anthrax case. The FBI closed Amerithrax last year with a report that linked the attacks to a broth of spores stored in a flask in the Fort Detrick lab of Army scientist Bruce E. Ivins. The letters killed five people and terrorized a nation still reeling from the Sept. 11 attacks.

The public learned of Ivins in 2008, when he swallowed a lethal dose of headache pills as the FBI closed in. But scientists at the Institute for Genomic Research in Rockville made the genetic leaps that would link the attacks to Ivins years earlier, in 2003.

“The guy really succeeded in scaring a lot of people,” said Steven Salzberg, who ran computational work at the Rockville lab. He now directs the Center for Bioinformatics and Computational Biology at the University of Maryland.

Salzberg and his colleagues are now free to discuss their work. So are Terry Abshire and Pat Worsham, lab workers at Fort Detrick, who first spotted the genetic oddities that would lead federal agents to a lab on their own compound.

The two teams — one at a private lab in Rockville, the other at a military installation in Frederick — produced pioneering work in an environment of exhaustion and fear. Ordinary citizens fretted about contracting anthrax through the mail or from the very air they breathed. For members of the two science teams, the danger seemed incomparably nearer.

“It was not only coming to work. It was worrying about what might be in your mail,” said Abshire, whose daughter and granddaughter were living with her at the time. “There was one point where I was bleaching everything down before I came in the house.”

When the anthrax case began, FBI agents had no actual fingerprints, no convenient DNA sample with which to collar a suspect. What they had were spores, and it wasn’t clear how to trace them to their source.

The Rockville scientists, tapped by the FBI, knew they might be able to identify, in essence, a genetic fingerprint in the spores themselves. Such technology had been pioneered at the lab in 1995.

“It immediately occurred to me that we could sequence it and decode its genome,” Salzberg said. “We were the world’s premier place for doing DNA sequencing with bacteria.”

Even with that expertise, the Rockville team at first struggled to identify the tiny genetic anomalies that might set this anthrax apart from a thousand other specimens.

Unbeknown to them, somebody already had.

On Oct. 17, 2001, just days after the anthrax letters were mailed, Abshire, a lab technician at Fort Detrick, was growing bacteria to confirm that the powder in the letters was, indeed, anthrax.

On one plate, Abshire saw something remarkable: a bacterial colony with a distinctly different appearance than others. Most spore colonies were grayish, “flat, like a disc,” she said. This one was “raised, it was more dome-shaped, and it had a different color to it — it was more tannish.”

Abshire, a seasoned lab tech, knew the gravity of her find. The aberrant colony was telling her something about the genetic signature of the specimen.

“It took somebody with a lot of experience with anthrax to recognize that,” said Jason Bannan, an FBI microbiologist who worked on Amerithrax.

Abshire told her superiors but said “it took a while before anybody had any interest in it. There was so much going on.”

One colleague who did take note was Worsham, an investigator in the bacteriology division at Fort Detrick. Soon, Worsham was growing thousands of cultures from the powder in the mailings. She found more mutants — many more, including the four ultimately used by the FBI to crack the case.

The mutants suggested that the anthrax sent in the mail might actually be a blend of spores from different origins — like a sack of Colombian coffee beans with a few beans from Guatemala and Sumatra tossed in.

In 2002, the FBI delivered the Fort Detrick samples identified by Abshire and Worsham to the team in Rockville. It was a crucial break. Now, the scientists could turn their attention to the unusual mutations. By decoding them, they could identify the genetic markers of the anthrax used in the attack.

“We sequenced the genome of those colonies that were different,” the odd growths first spotted by Abshire, said Jacques Ravel, a leader of the research team who now works at the Institute for Genome Sciences at the University of Maryland School of Medicine.

The team chose four mutations for closer study, “and the combination of those four together — the idea was that it would form a unique signature,” Ravel said.

By fall 2003, the Rockville scientists had mapped out the four mutations. Ravel told his colleagues in an e-mail that the FBI was “very excited” with the results. It would be years before they saw the fruits of their work.

“We knew it was helping them, but we didn’t know exactly how,” Salzberg said. “They wouldn’t tell us.”

FBI scientists then launched a massive effort to screen more than 1,000 anthrax samples for those mutations. They would eventually identify eight matches, all from a single source, a flask in Ivins’s lab marked RMR-1029.

Science had linked Ivins to the attacks as early as spring 2005, although even the compartmentalized FBI scientists didn’t know it at the time. By 2007, every other anthrax sample had been ruled out and the bureau could conclude that “Dr. Ivins, alone, mailed the anthrax letters.”

Many have since questioned that conclusion. There was no smoking gun, no irrefutable proof Ivins was even involved in the attack, let alone its sole author. A review published this year by the National Academy of Sciences found loose ends in the case — but not in the work of the Rockville and Fort Detrick scientists.

Staff researcher Magda Jean-Louis contributed to this report.