DUSHANBE (Reuters) - 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 militant group Islamic State 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 Islamic State, are generally held. It also houses other prisoners.

Both officials said at least 25 inmates were killed, as well as one warder and one 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 lies around 300 km (185 miles) north of the Tajik capital, Dushanbe.

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