Assailants have set off explosives and opened fire in an attack on the premises of the Turkish state-run aerospace and defence company TUSAS, killing four people and wounding several, President Recep Tayyip Erdogan said.

At least two of the attackers died, interior minister Ali Yerlikaya said.

“We have four martyrs. We have 14 wounded. I condemn this heinous terrorist attack and wish mercy on our martyrs,” Mr Erdogan said during a meeting with Russian President Vladimir Putin on the sidelines of a meeting in Kazan, Russia.

Mr Putin offered him condolences over the attack.

Emergency rescue teams and police officers work outside the building (IHA/AP)

Selim Cirpanoglu, mayor of the district of Kahramankazan, told the Associated Press that the attack on the company on the outskirts of the capital Ankara had abated but could not provide more details.

It was not clear who was behind it. Kurdish militants, the so-called Islamic State group and leftist extremists have carried out attacks in the country in the past.

Security camera images from the attack, aired on television, showed a man in plain clothes carrying a backpack and holding an assault rifle.

Turkish media said three assailants, including a woman, arrived at an entry to the complex in a taxi. The assailants, who were carrying assault weapons, then detonated an explosive device next to the taxi, causing panic and allowing them to enter the complex.

Multiple gunshots were heard after Turkish security forces entered the site, the DHA news agency and other media reported. Helicopters were flying above the premises.

TUSAS designs, manufactures and assembles civilian and military aircrafts, unmanned aerial vehicles (UAVs) and other defence industry and space systems.

The UAVs have been instrumental in Turkey gaining an upper hand in its fight against Kurdish militants in Turkey and across the border in Iraq.

Vice president Cevdet Yilmaz said the target of the attack was Turkey’s “success in the defence industry”.

“It should be known that these attacks will not be able to deter the heroic employees of defence industry,” he tweeted.