Hospital officials say Mehmet Selim Kiraz, the prosecutor held hostage in Istanbul by leftist gunmen has died.

The prosecutor was shot in the head and several other parts of his body and underwent surgery, Turkish President Recep Tayyip Erdogan said in an AP report.

Two gunmen from DHKP-C were killed by police when special forces stormed the Istanbul courthouse.

During the siege, gunmen from a banned Marxist revolutionary group had released images of a gun being held to the head of Mehmet Selim Kiraz as the hostage crisis unfolded.

A statement posted online said the prosecutor, Mehmet Selim Kiraz, would be killed if the group's demands were not met.

Istanbul's police chief Selami Altunok said that police had negotiated with the gunmen for six hours, but eventually stormed the courthouse "because of gunshots heard from inside the prosecutor's office".

Gunshots were heard and smoke was seen rising from the scene, after special forces entered the building.

The prosecutor was reportedly taken hostage because he had headed an inquiry into the death of Berkin Elvan during anti-government protests in 2013.

Sukriye Erden, a lawyer negotiating with the hostage takers, told the BBC that they had demanded that the police announce the names of four members of the security services whom they said were connected to the death of Elvan.

14-year-old Elvan was struck in the head by a police tear gas canister in June 2013 as he went to buy bread during huge demonstrations that began in Istanbul and spread across Turkey.

He died in an Istanbul hospital in 2014, after spending nine months in a coma.