Riot reportedly broke out in the city of Khujand late on Wednesday, confirmed by the city government.

At least 25 inmates and two security officers have been killed after a riot broke out at a high-security prison in Tajikistan, three security sources said on Thursday.

The violence started late on Wednesday when an inmate, believed to be a member of the Islamic State of Iraq and the Levant (ISIL), attacked a guard and seized his assault rifle, said an interior ministry official who declined to give his name.

Officers restored order hours later with the help of reinforcements, a security official speaking on condition of anonymity said.

The prison in the northern Tajik city of Khujand is where prisoners convicted of religious extremism offences, including membership of ISIL, are generally held. It also houses other prisoners.

The officials said at least 25 inmates were killed along with a warder and a policeman. The third source, also a security official, said three guards had died.

Local authorities confirmed a riot had occurred but gave no details.

Khujand is about 300km north of capital Dushanbe.

In July, ISIL claimed responsibility for an attack which killed four Western tourists in Tajikistan, an impoverished Central Asian country.

In 1997, security forces had reportedly killed at least 24 people after a riot broke out in Khujand prison, according to a Human Rights Watch report. Non-governmental sources, however, claimed that as many as 100 prisoners were killed.