LONDON - A Moroccan arrested nearly three years ago as an alleged conspirator in the Sept. 11 attacks was ordered released yesterday by a British court that said his detention was arbitrary and unjustified.

Farid Hilali was arrested in June 2004 on a European warrant after he was named with 34 others as an alleged conspirator in the attacks. He has been held in British prisons while fighting extradition to Spain.

Spanish authorities accused him of links to Syrian-born Spaniard Imad Yarkas, who allegedly founded and led an al-Qaeda cell in Spain. Hilali was allegedly recorded telling Yarkas he had "entered the field of aviation" and spoke of "cutting the bird's throat" - an apparent reference to the American national symbol of a bald eagle, prosecutors said.

But last year, Spain's Supreme Court voided Yarkas' conviction of conspiracy to murder in connection with the Sept. 11 attacks. Yarkas remained in prison on a separate conviction of belonging to a terrorist organization.

Hilali's detention became unjustified when Yarkas' conviction was thrown out, Justices Janet Smith and Stephen Irwin said.

"If what is alleged against this applicant is that he was involved in the preparation for the attacks through his links with Yarkas and not independently of Yarkas, there is no basis for alleging this once it is known that Yarkas is not guilty of involvement," the judges ruled.

Hilali was not immediately released, pending a possible prosecution appeal to the House of Lords, Britain's highest court.