HATAY, Turkey — One is a NASA scientist who was vacationing with relatives in Turkey. Another is a Christian missionary who has lived in Turkey for 23 years. Others include a visiting chemistry professor from Pennsylvania and his brother, a real estate agent.

They are among a dozen Americans who have been jailed by the government of President Recep Tayyip Erdogan and face long prison sentences for allegedly playing a part in a failed coup last year.

Mr. Erdogan’s crackdown since then has swept up tens of thousands of Turks — military officials, police officers, judges, journalists and others — in prosecutions and purges that are wrenching Turkey back to darker eras it had appeared to have left behind.

And amid deteriorating relations with the United States and Europe, Turkey is also arresting increasing numbers of foreign nationals. Most, including the Americans, are accused of ties to the Islamist cleric Fethullah Gulen, who Turkey says orchestrated the conspiracy from his self-imposed exile in Pennsylvania.