Chaudhry Zulfikar was shot at least 13 times as he drove to court in the capital Islamabad.
He then lost control of his car, which hit a woman passer-by and killed her, police said.
Mr Zulfikar was also prosecuting militants linked to the 2008 terror attack in the Indian city of Mumbai.
Although the motive for the killing was unclear, the prosecutor's involvement in the two high-profile cases is likely to be scrutinised closely.
More top news
The England footballer admitted one count of sexual activity with a girl under 16 and one count of child grooming.
The gymnast took a few steps with the assistance of nurses after her accident in the reality show, her family said.
A baby who was unable to tell which of two identical twin brothers was his father has been watched millions of times online.