Two members of a banned leftist group who had held a prosecutor hostage in his office inside a courthouse in Istanbul have been killed in a shootout with Turkish police that left their captive seriously wounded.
The prosecutor has been taken to hospital, said Istanbul police chief Selami Altunok.
Police had negotiated with the gunmen for six hours before the violent end to the hostage situation, Altunok said.
Private news agency Dogan earlier reported police special forces had entered the building, which was evacuated. It was not clear how the assailants sneaked the arms into the courthouse.
The state-run Anadolu Agency and state television, TRT, identified the prosecutor as Mehmet Selim Kiraz.
He is the prosecutor investigating the death of a teenager who was hit by a police gas canister fired during nationwide anti-government protests in 2013.
A website close to the left-wing DHKP-C group said that militants from the banned organisation had taken the prosecutor hostage at midday and had given authorities three hours to meet five demands, including forcing policemen held responsible for the teenager’s killing to confess to the death.
The group also demanded that the policemen be tried by “people’s courts” and for court officials to drop prosecutions or investigations against people who took part in protests denouncing the boy’s death.
The website showed a picture of someone holding a gun to a man’s head with posters from the group in the background.
Deputy chief prosecutor Orhan Kapici confirmed that the incident was related to Mr Kiraz’s investigation into the boy’s death.
The DHKP-C, which seeks a socialist state, is considered a terrorist organisation by Turkey, the US and the European Union.
The group has carried out sporadic attacks, including a suicide bombing at the US embassy in 2013 which killed a security guard. The group was more active in the 1970s.
UPDATE: at 9.30pm
A prosecutor who was held hostage by members of a banned leftist group inside a courthouse in Istanbul has died after police attempted to free him, Turkish officials said.
The prosecutor died of gunshot wounds he sustained in a police shootout with the hostage takers, who also died, said prime minister Ahmet Davutoglu.
President Recep Tayyip Erdogan earlier said the prosecutor had been shot in the head and several other parts of his body and was in surgery.