The mutiny broke out on Tuesday afternoon when "almost 300 Al-Qaeda prisoners, armed with knives and iron bars, attacked prison guards, injuring some of them," the official said, adding that an interrogation officer was among those wounded.
The prisoners, who smashed the doors of their cells and broke down the prison's first security barrier, seized weapons and took some guards hostage.
Using the weapons, they clashed with guards manning the second security barrier, who returned fire and managed to "foil the group's attempt to flee," the official said.
A number of inmates were wounded but none were killed, several sources said.
Signup to our newsletter and follow us on Facebook and Twitter!
The prisoners released their hostages early on Wednesday after mediation but held onto their weapons, the official said, adding that police were still trying to control the situation in the prison.
Nasser al-Wuhayshi, chief of Al-Qaeda in the Arabian Peninsula -- seen by the United States as the network's deadliest franchise -- vowed in August to release imprisoned members of his network.
Wuhayshi himself escaped from the same Sanaa prison with 22 other members of AQAP in February 2006 and was named as the group's leader a year later.
The AQAP detainees escaped through a 44-metre (145-foot) tunnel between their cell and a nearby mosque they dug with tools.
AQAP has taken advantage of the weakening of the central government in Sanaa since a popular uprising that toppled president Ali Abdullah Saleh in 2011.