A member of Sudan’s secret police has said he collaborated with the British National Crime Agency in order to facilitate the arrest of a suspected human trafficker who may be a victim of mistaken identity.

As millions of Sudanese protesters forced the removal of Omar al-Bashir as president, Italian prosecutors controversially invited two of his officials to Palermo to testify in the case against the arrested man.

Aid groups describe Sudan’s National Intelligence and Security Service (Niss) as one of the most brutal forces in the world, accusing it of torturing, raping and killing thousands of people.

The two officials were part of a joint operation between Bashir’s regime, the Italian police and the NCA responsible for the arrest in Khartoum in 2016 of a 35-year-old Eritrean man who they alleged was Medhanie Yehdego Mered.

Mered, known as “the General”, was suspected of being one of the world’s most-wanted people traffickers. But since prosecutors in Sicily announced the arrest, serious doubts have been raised about the man’s identity.

A documentary last year by the Swedish broadcaster SVT, in collaboration with the Guardian, concluded Mered was “living it up” in Uganda, while the arrested man, a refugee whose name is Medhanie Tesfamariam Berhe, was delivered to authorities in Italy.

DNA samples taken from Mered’s three-year-old son and from Berhe’s mother also suggest it is a case of mistaken identity.

The prosecutor’s office in Palermo continues to insist the arrested man is Mered, despite the fact it has not been able to provide a single witness to testify against him in the past three years.

One of the officers, Elsadeg Elnour Adbelrahman, admitted being a member of Niss and said he had met NCA agents in Khartoum in May 2016.

“We were told we had to arrest a man who was accused of human trafficking,” he said. “They gave us a picture and a phone number. We have just executed the order. The detainee told us he was not the trafficker Medhanie Yedhego Mered, but called himself Medhanie Tesfamariam Berhe. He also said he was a refugee and that a trafficker had asked him for $1,800 to reach Europe.”

The judge asked the other officer whether the search of the detainee and his interrogation had taken place in the presence of a lawyer. Lt Amir Ibrahim Abdelsadig Mahmoud said: “The presence of a lawyer can be required by Sudanese law, but we did not think to ask the detainee if he needed one.”

At the end of the hearing, Berhe described being tortured by Sudanese police officers.

“They beat me when they arrested me, beat me in prison,” he said. “They blocked me with a heavy chain and tried to take off my clothes and do bad things to me. I had an ID card with me from Eritrea and a document from the refugee camp when I was in Ethiopia.

“But they took everything. I had a little money with me and they took that too. They told me if I’d had more money, they would have released me.”

Berhe’s lawyer, Michele Calantropo, told the Guardian: “Today in court, we heard the testimony of a member of one of the most brutal police bodies in the world about how he had arrested my client. I think there is nothing to add.”

Riccardo Noury, a spokesman for Amnesty International in Italy, said: “In the last days, Niss has been involved in the brutal crackdown on the Sudanese protesters. The fact that today, in an Italian court, a member of Niss was speaking before a judge is totally unacceptable.”

In the past week, as more than 30,000 signatures have been gathered in favour of Berhe’s release, hundreds of people have been protesting in Oslo, Stockholm, London and Frankfurt, calling for Italian authorities to release the arrested man. They are all Eritreans and many of them were trafficked to Europe by Mered, who appears to be still on the run.