A 'Libyan national' opened fire with a pump-action rifle in the courtyard of Istanbul's Topkapi Palace  [Reuters]

A heavily armed man wounded two people before being shot dead at one of Istanbul's top tourist attractions, authorities and local media said.

The man entered the Topkapi Palace, across the city's Blue Mosque on the banks of the Bosphorus Strait, and began shooting in all directions with a pump action shotgun, NTV television quoted Istanbul police chief Huseyin Capkin as saying.

"With his weapon he began to fire everywhere," he said.

The man shot a soldier and a security guard at the entrance of Istanbul's Topkapi Palace on Wednesday.

The man has been identified as Libyan national born in 1975, according to Idris Naim Sahin, the Turkish interior minister.

Sahin told reporters the man was using a car registered in neighbouring Syria, whose relations with Turkey have slumped in recent months.

"It had a Syrian registration plate. It belongs to someone else, but the links are not very clear," Sahin said.

He said that despite the registration, the man was a Libyan national who had entered the country on Sunday.

Police's anti-terrorism squads and sharpshooters killed the attacker, Huseyin Capkin, Istanbul's police chief, said.

A picture by IHA news agency showed the man carrying at least two rifles and a cartridge belt around his neck. The picture shows the man wearing black overcoat, cap and carrying a backpack.

"The state of our soldier is good, but that of the security guard is more serious," Istanbul Governor Huseyin Avni Mutlu told Anatolia news agency, which named the attacker as Samir Ali Salem Elmadhavri.

Huseyin Avni Mutlu,  Istanbul's governor, said the motive of the attack was not immediately known, but that police decided to shoot him when the man seemed determined not to surrender.

He responded to a question in Arabic language moments before the attack, a witness, Idris Cengiz, told AP.

Witnesses said the man shot the soldier in the leg and the guard in the abdomen before running into the palace courtyard.

"I saw the gunman carrying a gun on his shoulder, like a hunter; he had ammunition around his neck and a backpack. His overcoat was buttoned, I couldn't see what was underneath," Cengiz said.

"He was coming towards us and my friend said he looked like a hunter, so I asked him in English 'Are you a hunter?' He said something in Arabic which I didn't understand. Then he said 'Allahu Akbar' (God is Great)."

Cengiz said he and his friend heard the bullets being fired moments later. "When we ran we saw a soldier and a security guard lying on the ground," he said.

Some tourists also threw themselves on the ground in panic, Cengiz said. There were no other reports of injuries in the attack.

The Topkapi Palace is a historic royal residence in Istanbul, that was the primary residence of the Ottoman Sultans and is now a major tourist attraction that contains national treasures and holy relics of the Muslim world.

Source: Agencies