EDITOR'S NOTE: Associated Press photographer Burhan Ozbilici was attending a photo exhibition Monday when a gunman opened fire, killing Russia's ambassador to Turkey. He recounts how he captured the chaotic scene with his camera despite the lethal danger.

ANKARA, Turkey — The event seemed routine, the opening of an exhibit of photographs of Russia. So when a man in a dark suit and tie pulled out a gun, I was stunned and thought it was a theatrical flourish.

The gunman is seen moments after shooting Andrey Karlov, Russian Ambassador to Turkey, at a gallery in Ankara on Monday. Burhan Ozbilici / AP

Instead, it was a coolly calculated assassination, unfolding in front of me and others who scrambled, terrified, for cover as the trim man with short hair gunned down the Russian ambassador.

The gunshots, at least eight of them, were loud in the pristine art gallery. Pandemonium erupted. People screamed, hid behind columns and under tables and lay on the floor. I was afraid and confused, but found partial cover behind a wall and did my job: taking photographs.

The exhibition, titled "From Kaliningrad to Kamchatka, from the eyes of travelers" featured photos from Russia's westernmost Baltic region to the Kamchatka Peninsula, in the east. I decided to attend simply because it was on my way home from the Ankara office.

When I arrived, the speeches had already begun. After Russian Ambassador Andrey Karlov began to make his address, I moved closer to photograph him, thinking the pictures would come in useful for stories on Turkish-Russian relations.

He was speaking softly and — from what I could tell — lovingly about his homeland, stopping occasionally to allow the translator to relay his words in Turkish. I remember thinking how calm and humble he seemed.

Then came the gunshots in quick succession, and panic in the audience. The ambassador's body lay on the floor, just meters away from me. I couldn't see any blood around him; I think he may have been shot in the back.

It took me a few seconds to realize what had happened: A man had died in front of me; a life had disappeared before my eyes.

I moved back and to the left, while the gunman — later identified as police officer Mevlut Mert Altintas — gestured with his gun at people cowering on the right side of the room.

People crouch in a corner after Andrey Karlov, the Russian Ambassador to Turkey, was shot at a gallery in Ankara, Turkey, on Monday. Burhan Ozbilici / AP

At first, I couldn't figure out what had motivated the shooter. I thought he might be a Chechen militant. But people later said he was shouting about the Syrian city of Aleppo.

So he was probably angry about Russian bombardments of Aleppo that were aimed at driving out anti-government rebels. Many civilians have been killed in the fighting.

He also shouted "Allahu akbar," but I couldn't understand the rest of what he said in Arabic.

The gunman was agitated. He walked around the ambassador's body, smashing some of the photos hanging on the wall.

I was, of course, fearful and knew of the danger if the gunman turned toward me. But I advanced a little and photographed the man as he hectored his desperate, captive audience.

This is what I was thinking: "I'm here. Even if I get hit and injured, or killed, I'm a journalist. I have to do my work. I could run away without making any photos. ... But I wouldn't have a proper answer if people later ask me: 'Why didn't you take pictures?'"

I even thought about friends and colleagues who have died while taking photographs in conflict zones over the years.

As my mind raced, I saw that the man was agitated — and yet, he was, strangely, in control of himself. He shouted at everyone to stand back. Security guards ordered us to vacate the hall and we left.

Ambulances and armored vehicles soon arrived and the police operation was launched. The gunman was later killed in a shootout.

When I returned to the office to edit my photos, I was shocked to see that the shooter was actually standing behind the ambassador as he spoke. Like a friend, or a bodyguard.