Prosecutors conceded that to obtain information on any immediate threats, the F.B.I. initially interviewed men without advising them of their rights, but subsequently interviewed them separately and explained their rights to them; prosecutors eventually agreed not to use any of the statements taken in Djibouti at trial.

All three men were sent to the United States for prosecution in late 2012, and have been held in solitary confinement since.

Their lawyers in the United States filed a motion to dismiss the charges against them, which included providing material support to a terrorist group and conspiracy to provide such support. “Nothing that the government has provided to date shows that the defendant had any notice or reason to believe that he was subjecting himself to U.S. law and could be hauled into a U.S. court for his conduct,” Jane Simkin Smith and David Stern, lawyers for Mr. Yusuf, wrote in a motion that the other defendants joined.

Brooklyn prosecutors prevailed, however, pointing to earlier rulings about how terrorism law can be used globally.

In 2004, when Congress updated the terrorism law, it said that extraterritorial jurisdiction applies in six situations. One that was applied here was breathtakingly simple: that the person is “brought into” the country after the conduct in question. Here, the prosecutors and F.B.I. flew the men into Kennedy International Airport from Djibouti. As a Southern District federal judge, P. Kevin Castel, ruled in the case of Mr. Ahmed, bringing someone in “alone is a sufficient statutory predicate for jurisdiction.”

Prosecutors, though, are reluctant to rely entirely on the fact that the person was flown — by the United States government — into the United States, and here they relied on two additional justifications. One was that the defendants “aided and abetted” United States citizens when they recruited, talked to or fought alongside them in Somalia. Another was that the acts affected foreign or interstate commerce, where these defendants recruited people to go overseas and those people spent money getting there