Herat Public Health officials confirmed the deaths, and said 12 others including four prison guards were wounded.
However, the head of Herat ambulance services Ibrahim Mohammadi said early Thursday morning that one police soldier and one prisoner had died and 18 wounded had been taken to hospital.
Further details around the prison riot have not been provided but unconfirmed reports indicate a fight broke out while police were trying to close illegal shops inside the prison – which sparked an angry response from prisoners.
Reports also indicate a part of the prison had been set on fire.
The prison is situated in the heart of Herat city, and for residents in the close vicinity the situation had been a major concern as gunshots rang out through much of the night.
But reports indicate clashes lasted a few hours until the situation was eventually brought under control at about midnight.
Neither police nor prison officials have yet provided further details.