The inmates were evacuated and the injured were rushed to hospital after the fire broke out at dawn in Al-Malaz prison, jail authorities said in a statement carried by the official Saudi Press Agency.
Firefighting "specialists with the help of civil defence were able to bring the fire under control and prevent it from spreading," the statement said. "As a result (of the fire) three deaths occurred and 21 were injured."
It did not state the cause of the fire, but said an investigation had been launched.
Accidental fires are common across the desert kingdom of Saudi Arabia, sometimes because of lax enforcement of safety regulations.
In September, five people were injured in a fire that broke out at a new high-speed train station in Jeddah, with huge palls of smoke seen rising into the air.
The station serves the main Haramain High Speed Rail system, which transports passengers between Makkah and Medina.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ