A former American history specialist at the Library of Congress was ordered to spend a year on home detention yesterday after pleading guilty in U.S. District Court to charges stemming from the theft of $25,000 in rare books.

James W. Gilreath also was ordered to perform 500 hours of community service, undergo counseling, pay a $20,000 fine and stay away from the Library of Congress, where he worked until the thefts were discovered last year.

Prosecutors said Gilreath was caught after he attempted to sell eight rare books to a Boston antiquarian dealer, including a two-volume French translation of Walt Whitman's "Leaves of Grass." The shop owner examined the books and became suspicious: One had a Library of Congress stamp. She contacted the library, which in turn alerted the FBI and other authorities.

The FBI was at the store when Gilreath showed up expecting to complete the sale in January 1997. Agents said they turned up additional missing books when they searched Gilreath's condominium in Georgetown and a home belonging to relatives in Andover, Mass., where he had been living.

Prosecutors said Gilreath took about two dozen books by such authors as Whitman, Henry David Thoreau and Upton Sinclair. They said he approached at least one other book dealer about the Whitman volumes.

Assistant U.S. Attorney Carol Fortine said authorities believe that all of the books taken by Gilreath have been recovered.

Gilreath, 51, entered what is known as an Alford plea in March to charges of theft and interstate transportation of stolen property. Under Alford pleas, defendants do not explicitly admit guilt but acknowledge that prosecutors have enough evidence to convict them. An Alford plea is recorded as a guilty plea.

Defense attorney Reita Pendry said Gilreath was suffering from significant brain damage at the time of the offense, resulting from an earlier head injury. Doctors said the injury affected his memory and cognitive skills. In court yesterday, Gilreath told Judge Emmet G. Sullivan that he was attempting to get himself back on track through counseling in Massachusetts.

The case marked the first time in recent years that a Library of Congress curator was charged with theft. Gilreath, who began work at the library in 1974, had access to the items as part of his duties in the library's rare books division. Many of the stolen books came from a library collection that once belonged to Horace Traubel, Whitman's confidant and biographer. The "Leaves of Grass" set, for example, was inscribed for Traubel by the translator, Leon Bazalgette, and worth an estimated $10,000.