A masked officer collected his belongings from an intelligence office in Basra, raided overnight by Iraqi special forces. The Iraqi prime minister has ordered an investigation into the raid. Photograph: Essam Al-Sudani/AFP/Getty Images

The Iraqi prime minister has called for an investigation into an operation by Iraqi and British forces in Basra which found evidence of torture when they raided an Iraqi intelligence agency detention centre yesterday.

Officials at the detention centre, part of a police compound in the city, told Reuters news agency that 37 prisoners were freed in the raid. They showed journalists offices that had been searched, with files thrown on the floor, desks overturned, and doors broken open in the pre-dawn raid.

British spokesman Major David Gell said the raid on the National Iraqi Intelligence Agency detention facility in central Basra was part of an operation led by Iraqi forces. "Five individuals were arrested on suspicion of serious terrorist activities, including involvement in improvised explosive devices and attacks against both civilians and multinational forces. The Iraqi counter-terrorist forces then exploited information received, and that's when the National Iraqi Intelligence Agency building was subsequently struck," he said.

"We believe there were about 30 people found imprisoned in the building and there was evidence of torture," Major Gell said.

But the prime minister, Nuri al-Maliki, a Shia Islamist who has vowed to crack down on militias blamed for sectarian killings, issued a statement saying he had ordered an investigation into the incident and "affirming the need to punish those who have carried out this unlawful and irresponsible act".

Shia militias and criminal groups are vying for control of the oil-rich region bordering Iran where smuggling is also rife.

Qassim Mohammed said he was among the detainees freed during the raid, but he returned to the scene yesterday "because I am innocent and I don't want to be an outlaw. I came back to complete the procedures to be freed".

He told Reuters: "About 3.00 or 3.30 (am) we heard the sound of the breaking of windows and doors; then there was a lot of noise as people came in, and then we heard the door of the prison opened." He said he had not been tortured.

He said he saw one of the officers at the detention centre detained and taken away by Iraqi and foreign troops.

Military sources said British troops were present in the operation in a back-up role. Major Gell said he could not confirm any arrests at the detention facility, but said the five suspects arrested earlier were involved in kidnapping, torture, murder, and bomb attacks.

"It was clearly a very successful operation. The Iraqi forces achieved their objective of detaining individuals; it's a clear demonstration of Iraqis taking responsibility for security, and obviously a very positive sign".

In December, British forces blew up the headquarters of the police serious crimes unit in Basra in a raid to rescue prisoners they said were about to be killed.

In a separate operation on Saturday, British troops raided what the Ministry of Defence described as rogue militia elements, following an attack on a British base in Basra.

The operation, codenamed Operation Phoenix, was launched after gunmen involved in the attack were tracked to a building west of Basra's Al Jameat district. British troops uncovered what the MoD called a significant arsenal of ammunition, weapons, and bomb-making equipment, hidden in a vehicle at the property.