FILE PHOTO: People wait in front of the visa application office entrance of the U.S. Embassy in Ankara, Turkey, October 9, 2017. REUTERS/Umit Bektas

ISTANBUL (Reuters) - Turkish police detained four Iraqi nationals on Monday on suspicion of planning an attack on the U.S. Embassy in Ankara, the state-run Anadolu Agency said, hours after the mission temporarily closed due to a security threat.

Police detained four Iraqis residing in the Black Sea province of Samsun who had been preparing for an attack on the embassy, Anadolu said.

The embassy said it was closed to the public on Monday due to a security threat was only providing emergency services would be provided. It did not specify the nature of the security threat. It will also be closed on Tuesday.

It advised U.S. citizens in Turkey to avoid large crowds, the embassy building, and to be aware of their own security when visiting tourist sites and crowded places.

While relations between the United States and Turkey - both NATO allies and members of the coalition against Islamic State - have been strained in recent months, Turkey said the embassy closure was not political.

“The decision to close the American embassy is not a political one, it was taken on security grounds. The embassy has shared intelligence with the Turkish intelligence service and security forces,” Deputy Prime Minister Bekir Bozdag, the government’s main spokesman, told a news conference.

“Both the intelligence service and security forces have taken extra measures, and important results have been achieved,” he said, without elaborating.

The United States suspended visa services at its missions in Turkey in October after two local employees were held on suspicion of ties to the failed 2016 coup. Ankara reciprocated and visa restrictions between the two were not lifted until the end of December.

The embassy said it would make an announcement when it was ready to reopen.