You are not permitted to download, save or email this image. Visit image gallery to purchase the image.
John Pope, charged with "malicious mischief and grave threat", pulled out his gun minutes before the hearing began.
He shot the prosecutor and the doctor and left the court during the commotion that followed. It was not clear how he was able to carry a handgun into the court premises.
While walking towards the lobby of a building opposite to the court, he shot the state prosecutor handling his case at point-blank range. The prosecutor was in critical condition in hospital, the National Bureau of Investigation said.
Police said they shot Pope in the arm, but he also shot himself in the head after falling to the floor, the bureau said.
Prosecutor General Claro Arellano said in a statement it was clear there was a "serious lapse in security" in the court premises, calling on the Supreme Court, overseer of courts all over the country, to investigate.