Updated

A young Somali captured in connection with the hijacking of a Spanish trawler and brought to Madrid has slipped into legal limbo, with courts unable to decide if he is an adult or a minor or who should prosecute him, an official said Wednesday.

For now the suspect has been transferred first from a prison to a home for troubled youths, then to a formal juvenile detention center, while the courts try to figure out how to proceed, the official of the National Court said on condition of anonymity in line with court rules.

Suspect Cabdiwell Cabdullahl — his nickname is Abdu Willy — and another Somali man were captured by Spanish naval forces in the Indian Ocean on Oct. 4, two days after the hijacking of the trawler Alakrana.

The trawler remains in control of pirates, and complicating things further are their reported demands for the release of their two detained colleagues as a condition for freeing the trawler and its 36-member crew, 16 of them Spaniards.

Cabdullahl's case has turned messy because of doubts about his age, and thus whether he should be handled by the National Court per se or its juvenile section. The juvenile section of the court has asked to take charge and a judge will rule on this Thursday, the National Court official said.

Cabdullahl has insisted he is a minor, which would entitle him to more lenient treatment if convicted of charges of kidnapping, criminal association and theft. Preliminary tests using X-rays to measure his wrist bones led authorities to rule he was in fact an adult.

But in a ruling Wednesday night, National Court Judge Santiago Pedraz said more exhaustive tests had been able to determine only that he is at least 17. Pedraz said that given this doubt, he had no choice but to release Cabdullahl.

The court's juvenile section intervened and had him sent to a shelter. The problem is that this section can only prosecute minors accused of terrorism, and Cabdullahl is not.

The idea emerged Wednesday night to transfer the case to the juvenile section of a Madrid regional court. But it quickly said it had no jurisdiction as Cabdullahl is not accused of committing a crime in Madrid, but rather outside Spain.

The Spanish newspaper El Pais called the case "a soap opera ... that seems to have no end."

The National Court's juvenile section has ordered more medical tests done on the suspect — this time on his teeth — to try to determine once and for all if he is an adult or a minor, the official said.

If it is ruled again that he is under age, that section want to take over, using a flexible interpretation of its remit.

Prosecutors at this section argued Wednesday that, even though it normally only handles minors accused of terrorism, the Spanish penal code does not explicitly bar it from handling other offenses. Furthermore, the case involves crimes committed against Spaniards abroad, and this falls under the jurisdiction of the National Court, of which the juvenile section is part, the official said.