Twenty-one people have been killed in an attempt to escape from detention at the headquarters of Nigeria’s secret police in the capital Abuja.
Police said the trouble started when a prisoner beat a guard with his handcuffs in an attempt to escape.
Local media say many of the police detainees are suspected members of the Islamist group Boko Haram.
The group has waged a violent four-year campaign to install a radical form of Islam in the north.
Thousands have been killed since the conflict started in 2009.
It is unclear whether all of those killed during Sunday’s unrest are prisoners.
A spokeswoman for the State Security Services, Marilyn Ogar, said two service personnel had been seriously injured in the incident.
Guards at the facility in Abuja opened fire after the attempted escape of one prisoner, she said.
The army was deployed to the area, which is near the presidential villa.
The Nigerian president’s spokesman Reuben Abati described the incident as an “attempted jailbreak” in a post on Twitter.
He said the situation was under control and that President Goodluck Jonathan was safe and well.
Boko Haram attacks have increased during the first three months of 2014, leaving hundreds of people dead.
UN Human Rights Commissioner Navi Pillay said earlier this month that human rights violations by Nigerian security forces were creating “fertile ground for Boko Haram to cultivate new recruits”.
Boko Haram was founded in Maiduguri in 2009. It wants northern Nigeria to become an Islamic state.