Somali pirates kidnapped and held Michael Scott Moore, a journalist, hostage for two-and-a-half terrifying years until a ransom payment secured his release in September 2014.
Two months later, Mr. Moore received a surprising message on Facebook.
"How are you, Michael?" the message said. "I am ur friend Mohammed Tahlil. I wants to speak with u."
The sender's Facebook page included his photograph. Mr. Moore recognized him as one of the men who guarded him during his captivity in Somalia. He decided to write back.
What followed was an extraordinary exchange of Facebook messages between the journalist and his former captor. How long they communicated and where the conversation ultimately led has not been made public, but in the summer, the Somali was taken into custody by United States authorities and jailed in New York City, court records show.
A federal indictment made public Wednesday charged the man, Mohamed Tahlil Mohamed, 38, with kidnapping, hostage taking, conspiracy and other counts. The authorities have not said where he was arrested or how he came to the United States.
The indictment identified his hostage only as "John Doe," but Mr. Moore confirmed on Thursday that he was the unnamed victim.
When asked about the arrest of Mr. Tahlil, Mr. Moore replied, "I'm not as happy as you might imagine that he's in jail." He declined to comment further and would not say whether the Facebook exchanges had in some way led to Mr. Tahlil's capture or surrender.
Heavily armed men abducted Mr. Moore when he was doing research on piracy in January 2012 near the inland town of Galkayo, about 400 miles northeast of the capital Mogadishu. Mr. Moore's book "The Desert and The Sea: 977 Days Captive on the Somali Pirate Coast," published in July, recounted his ordeal.
It appears from the Facebook exchanges -- some of which are detailed in a criminal complaint and others in Mr. Moore's book -- that the journalist developed a kind of affinity for Mr. Tahlil, who, in turn, provided Mr. Moore with information about his kidnappers.
In his book, Mr. Moore, 49, described his captivity as full of terror, pain and close calls. One of his abductors broke his wrist during the kidnapping and it did not heal for weeks. He witnessed the torture of a fellow hostage, who was hanged upside down from a tree branch while a man beat him on the chest and feet with a bamboo cane.
Eventually Mr. Moore's mother became involved in the negotiations for his release. The kidnappers demanded $20 million.
Mr. Moore was kidnapped by Somali pirates in January 2012 and was held hostage for two and a half years.
"My mom talked them down to $1.6 million," Mr. Moore said in an interview on NPR's "Fresh Air."
The criminal complaint is based largely on F.B.I. interviews with Mr. Moore after his release. It said some of Mr. Moore's Somali captors brandished AK-47 assault rifles, rocket-propelled grenade launchers and handguns. One of them made threats that if the ransom was not paid, Mr. Moore would be sold to the Shabab, an Islamist extremist group.