A senior State Department official offered something close to an apology for the U.S. response to a failed coup attempt in Turkey, as he worked to ease tensions with a crucial ally.

"The truth is I don't think that many of us fully understood — or maybe we didn't communicate that we understood — the depth of feeling and emotion in Turkey for the events of July," Deputy Secretary of State Antony Blinken said Tuesday night. "This was a dagger aimed at the heart of the Turkish state — and at the Turkish people."

The No. 2 official at the State Department was speaking at the 35th Annual Conference on U.S.-Turkey Relations in Washington D.C. — a fraught topic in recent months, since Turkish President Recep Tayyip Erdogan accused Western allies of "siding with coup-plotters and terrorists."

Blinken hailed the NATO ally for its help against the Islamic State in Syria and for "deterring further Russian aggression," despite Russian President Vladimir Putin's attempt to forge a relationship with Erdogan. Blinken also praised the Turks for welcoming millions of refugees into their country — a policy decision that he contrasted with the "xenophobic vitriol" directed at some refugees in the United States.

"There's a business case to be made for inclusion of refugees, who represent an incredibly creative, productive pool of talent — in Turkey, just as in the United States," Deputy Secretary of State Antony Blinken said Tuesday night.

"No one has demonstrated this with greater results than Hamdi Ulukaya, the CEO of Chobani who arrived in the United States from Turkey as a student," he continued. "He got a loan from the Small Business Administration and transformed a single shuttered factory into a yogurt empire, and made a point of hiring, training and giving back to locally resettled refugees. In return, from some quarters of this country, he has been slammed with death threats, xenophobic vitriol, and outrages mistruths for his leadership on behalf of refugees."

Blinken's comments came just days after the State Department rebuked Erdogan for arresting journalists. That condemnation of attacks on Ulukaya, which have been fanned by alt-right websites such as Breitbart, fit into a pattern in which he cushioned statements about U.S.-favored Turkish policies with criticisms of American domestic policies.

Blinken alluded to Erdogan's crackdown on media, saying the government needed to defend "freedom of expression and pluralism," even when those freedoms are abused, something he said happens regularly in the U.S.

"Here in the United States, we are reminded on almost a daily basis that the results of our own efforts do not meet our expectations and that the voices that prevail are often the loudest, not necessarily the wisest," he said. "But the measure of our courage as citizens, the measure of our resilience as governments, the measure of our strength as nations is how we face these tests — whether we retreat to practices of repression and intimidation or whether we confront our own imperfections with honesty, with openness, with transparency."