Ahmed Khalfan Ghailani was interrogated by the CIA for important intelligence information, U.S. District Judge Lewis A. Kaplan wrote in a decision that rejected defense requests to toss out the indictment on the grounds that Ghailani was denied a speedy trial.
"No one denies that the agency's purpose was to protect the United States from attack," Kaplan wrote.
Ghailani is charged in the August 1998 bombing of two U.S. embassies in Africa that resulted in the deaths of 224 people, including 12 Americans. His trial is set for Sept. 27.
The judge also defended the decision to bring a noncitizen accused of terrorism to trial in a civilian court. He said he understood "anger at wanton terrorist attacks" is behind the reasoning of those who argue alleged terrorists should not be tried in civilian courts.
"Their conclusion, however, is unacceptable in a country that adheres to the rule of law," Kaplan said.
The judge said Ghailani's right to a speedy trial also was not violated by the nearly three years he spent at Guantanamo Bay before he was brought to the United States last year.
Kaplan said his status as an enemy combatant always has made it uncertain whether he ever will be freed and none of the delay was attributable to a quest for tactical advantage.
The judge said civil claims or even criminal charges could be brought if Ghailani was subjected to illegal methods of questioning during the interrogation that followed his July 2004 arrest.
Ghailani's lawyers have said he was subjected to "enhanced interrogation" for 14 hours over five days. As part of its enhanced interrogation program after the Sept. 11 terrorism attacks, the CIA at one time used 10 harsh methods, including waterboarding, a form of simulated drowning.
Kaplan said a prisoner's right to a speedy trial might be violated if his prosecution were delayed for an extended period while he faced "appalling or unlawful methods of interrogation even for important national security reasons." But, he added: "That is not this case."
He said the two years of interrogation in CIA-run camps overseas "served compelling interests of national security."
Four others were convicted for their roles in the bombings in federal court in Manhattan in 2001. They were each sentenced to life in prison.
Ghailani was accused by the government of being a bomb maker, document forger and aide to Osama bin Laden, who is also charged in the indictment. Ghailani has pleaded not guilty and has denied knowing that the TNT and oxygen tanks he delivered would be used to make a bomb.
A lawyer for Ghailani did not immediately return a phone message for comment on Tuesday's ruling.
By Associated Press Writer Larry Neumeister