WASHINGTON (CNN) — A federal judge has ordered the Bush White House to preserve its e-mails, just days before a new administration takes over.

The court’s preservation notice Wednesday stems from an ongoing lawsuit by private groups over allegedly missing electronic messages, and allegations the White House history of failing to properly monitor its internal communications among staff.

It has been a thorny legal and political issue for outgoing Bush officials, who are in the process of transferring more than 300 million e-mail messages and 25,000 boxes of documents to the National Archives.