ISTANBUL — Russia’s ambassador to Turkey was assassinated at an Ankara art exhibit on Monday evening by a lone Turkish gunman shouting “God is great!” and “don’t forget Aleppo, don’t forget Syria!” in what the leaders of Turkey and Russia called a provocative terrorist attack.

The gunman, described by Turkish officials as a 22-year-old off-duty police officer, also wounded at least three others in the assault on the envoy, Andrey G. Karlov, which was captured on video. Turkish officials said the assailant was killed by other officers in a shootout.

The assassination, an embarrassing security failure in the Turkish capital, forced Turkey and Russia to confront a new crisis tied directly to the Syrian conflict, now in its sixth year.

The longer-term implications for the Russia-Turkey relationship, which had been warming recently after plunging a year ago, were not immediately clear. But some analysts played down the notion that the assassination would lead to a new rupture, saying it could conversely bring the countries closer together in a shared fight against terrorism.