ANKARA, Turkey — President Recep Tayyip Erdogan of Turkey and the officials around him rarely miss a chance to call out Western hostility toward Islam.

When Danish newspapers published cartoons a decade ago that mocked the Prophet Muhammad, Mr. Erdogan quickly called for checks on press freedom. After the 2015 attack in Paris on the satirical magazine Charlie Hebdo, Mr. Erdogan warned that its blasphemous cartoons were “wreaking terror” on Muslims. And when Donald J. Trump made Islamophobia a central part of his presidential campaign last summer, Mr. Erdogan called for the rebranding of a pair of towers in Istanbul that bear Mr. Trump’s name.

Yet in recent weeks, Mr. Erdogan has kept quiet as President Trump has taken office and signed an executive order banning immigration from seven predominantly Muslim countries.

That is in large part because, at least for the moment, Mr. Erdogan sees Mr. Trump’s rise to the presidency as a chance to reset relations with the United States, which had nearly collapsed in the last years of the Obama administration, officials say.