He had served nine years in prison for the crime -- two on death row -- when he was released.
He had served nine years in prison for the crime -- two on death row -- when he was released.
When he was released  he had served nine years in prison.