WASHINGTON — The Postal Service on Friday confirmed that it takes a photograph of every letter and package mailed in the United States — about 160 billion pieces last year — and occasionally provides the photos to law enforcement agencies that request them as part of criminal cases.

The images are taken at more than 200 processing plants around the country and are used primarily to help the agency sort mail, the postmaster general, Patrick R. Donahoe, said in an interview with The Associated Press.

But Mr. Donahoe said that the images had been used “a couple of times” by law enforcement to trace letters in criminal cases, including one involving ricin-laced letters sent to President Obama and Mayor Michael R. Bloomberg of New York. The images of letters and packages are generally stored for a week to 30 days and then destroyed, he told the A.P.

Last month, The New York Times reported on the practice, which is called the Mail Isolation and Tracking system. The program was created by the Postal Service after the anthrax attacks in late 2001 killed five people, including two postal workers.