Istanbul's police chief, Selami Altunok said the prosecutor has been taken to hospital.
Altunok said police had negotiated with the gunmen for six hours before the violent end of the hostage situation.
Private news agency Dogan earlier today reported police special forces had entered the building, which was evacuated. It wasn't 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.
More From This Section
The group also demanded that the policemen be tried by "peoples' 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.
The DHKP-C, which seeks a socialist state, is considered a terrorist organization by Turkey, the US and the European Union.