U.S. District Judge James Parker voiced "great concerns about the extreme restrictions" imposed on Lee in jail, but said prosecutors had shown "clear and convincing" evidence that community safety could not be guaranteed with Lee's release.
The judge encouraged both sides to agree to another lie-detector test that might determine what happened to the missing tapes and whether Lee shared information with a foreign country.
Lee, 60, who has pleaded innocent, has said he destroyed the tapes after losing his security clearance. Lee was fired in March and indicted in December on 59 counts.
If both sides agree on another polygraph, "Dr. Lee's request for release can be considered in a different light," Parker said.
Lee faced extra security in jail, including monitoring of all family visits. Telephone access was limited and Lee was barred from communicating in Chinese.
The three-day hearing featured testimony from lab officials who detailed what they described as a concerted effort by Lee to download the nuclear secrets. Lee is accused of placing 19 classified files from a classified computer at Los Alamos National Laboratory to an unclassified computer and portable computer tapes.
Lee, 60, a naturalized U.S. citizen who was born in Taiwan, has pleaded innocent. The indictment does not accuse Lee of passing classified information to any foreign government.
Lee has sued the government, claiming he has been the victim of a smear campaign accusing him of spying for China.
Attorneys argued Wednesday over whether Parker had the authority to order the 24-hour FBI surveillance necessary for Lee's release.
U.S. Attorney John Kelly said the release conditions Parker was considering surveillance, electronic monitoring, limited visitation showed Lee should be detained.
Defense attorney John Cline argued Parker had the ability to order the FBI to conduct the necessary surveillance.
David Kitchen, the FBI special agent in charge of New Mexico, said the FBI had spent $8,000 a day on surveillance before Lee's arrest.
The only defense witnesses during the three-day hearing were Jean and Don Marshall, Lee's longtime neighbors and former colleagues at the lab. They testified Wednesday that they were willing to be Lee's custodians.
Prosecution witnesses spent two days offering testimony against Lee's release.
Paul Robinson, president of Sandia National Laboratories, testified Tuesday that Lee's release on bond could compromise U.S. security.