An Islamic State militant suspected of planning a suicide attack against the U.S. Consulate in Istanbul has been detained in Turkey, a government official said Tuesday.

The Syrian man was detained "in the past few days" at a bus station in the city of Kahramanmaras, close to the border with Syria, the official told The Associated Press. A court in Kahramanmaras ordered him jailed pending trial following questioning by anti-terror police. The official spoke on condition of anonymity in line because he wasn't authorized to speak publicly on the issue.

Last week, the U.S. Consulate in Istanbul warned U.S. citizens to avoid the building because of information about a security threat and suspended consular services for a day. Unconfirmed Turkish news reports had said the consulate was placed on high alert following intelligence about plans by Islamic State militants for a suicide attack.

The U.S. Embassy in Ankara also provided "limited operations" on Monday and Tuesday because of an unspecified security threat.

The state-run Anadolu Agency identified the suspect as Muhammed Raghil al-Hardani.

It said Turkish intelligence established that al-Hardani had crossed into Turkey "a while ago" and planned to attack the consulate. The intelligence was shared with U.S. officials.

According to Anadolu, authorities traced the man in Samsun, a city in northern Turkey, and monitored his movements. He was detained at the bus station in Kahramanmaras on his way to Gaziantep province, bordering Syria, while dining with another Syrian. Anadolu said the second Syrian was released after questioning.

Turkey was rocked by two suicide bombings — blamed on a Turkish ISIS cell — near a town on the Syrian border in July and in Ankara in October. More than 130 people were killed in those attacks.