A federal judge should not have ordered the Interior Department (search) to pull the plug on many of its Internet connections without giving the agency a chance to show it had improved security measures, a federal appeals court ruled Friday.

U.S. District Judge Royce Lamberth (search) ordered the shutdown in March after finding security holes could have allowed hackers access to hundreds of millions of dollars in royalties from Indian lands managed by the agency.

But the U.S. Court of Appeals for the D.C. Circuit said Lamberth ignored evidence showing Interior had addressed his concerns and faulted Lamberth for making the decision without holding an evidentiary hearing.

The shutdown lasted only nine days because the appeals court blocked Lamberth's order while it considered the Interior Department's appeal.

A department spokesman said he would not comment until officials had a chance to review the decision.

The ruling is the latest in a fractious, 8-year-old lawsuit pitting more than 300,000 American Indian landowners against the Interior Department. The landowners claim the agency stole, lost or never collected tens of billions of dollars in royalties it was assigned to manage from lands held in trust for the Indians.

The Indians sued the department in 1996, demanding an accounting that had been ordered by Congress two years earlier. In 1999, Lamberth said the department must account for the money and repair its management flaws.

Lamberth ordered the Internet shutdown — the third in three years — after the Interior Department refused to sign sworn certifications that it had fixed security flaws identified in 2001 by the court's special master, Alan Balaran (search).

Balaran determined that even a novice hacker could penetrate the accounting system's security and access data for the Indian revenues. The system processes hundreds of millions of dollars annually that is paid to American Indians for oil, gas, timber, and grazing activities on their land. The department is assigned to collect and disburse the funds.

The Interior Department resisted Balaran's oversight, saying his report did not show that unauthorized access presented an imminent danger to the integrity of the system. Balaran eventually resigned after Interior officials accused him of bias in the case.