Officials say the prosecutor who was held hostage by members of a banned leftist group that stormed a courthouse in Istanbul Tuesday has died.

Turkish Prime Minister Ahmet Davutoglu said the prosecutor died of the gunshot wounds he sustained in a police shootout with the hostage takers, who also died.

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.

The hostage situation began when militants from DHKP-C sent out photos of a member holding a gun to the head of Mehmet Selim Kiraz, 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 statement from the Revolutionary People's Liberation Front DHKP-C was published on a website Halkin Sesi saying that the prosecutor would be “punished by death” if the demands were not met by 3:36 p.m. As the deadline passed, the Turkish government imposed a ban on coverage, but special forces were reportedly taking up positions inside the building.

Late Tuesday evening, shots were heard and smoke was seen rising from the courthouse, as an ambulance sped to the building. 

The group's demands had included a “live” confession by the police officers suspected of killing Berkin Elvan, the prosecution of the officers responsible in a “people’s court,” the acquittal of all people being tried for participation in solidarity rallies for Elvan, as well as other requests.

Kiraz was appointed as the prosecutor of an investigation into the death of Elvan six months ago. The case is a particularly contentious one in Turkey. Elvan was a 15-year-old boy who died after being put in a coma by a police-fired gas cannister. He became a nationwide symbol for the culture of violence and impunity enjoyed by the police force in Turkey and his death sparked nationwide protests in 2014.

Hüseyin Aygün, a deputy from Turkey's main opposition Republican People's Party (CHP), wrote in a series of tweets that he had called Berkin Elvan's father, Sami Elvan, who had demanded the release of the prosecutor. "My son died, but another person should not die," he quoted the father as saying.

Twitter was flooded by further commentary criticizing the acts of the DHKP-C, one popular commentator asked whether the group had realized whether they had just handed the Turkish government the perfect justification to implement further controversial security laws.

Others wondered whether the power outage, which had affected 44 out of Turkey’s 81 provinces, leaving Istanbul, Ankara and other major cities without electricity for three hours, was responsible. A correspondent on NTV said the militants may have been able to enter the courthouse because security X-ray machines were out of use due to the power cuts.

The Associated Press contributed to this report