Four days after Islamist militants shot dead 21 tourists in Tunisia's Bardo museum last year, police rounded up dozens of people suspected of links with the gunmen.
One of the men, a laborer, was arrested in his Tunis home. The man, who has denied any connection to the militants, said he was taken to a police detention center where he was tied to a metal bar and had his head and feet smashed with a pipe.
"I told them everything, I even told them I was guilty, just so they would stop," said the laborer who is on release from prison and spoke to Reuters last month in the company of his attorney. "I thought I didn't have any other way out."
Several recent cases of police abuse – which the Tunisian government acknowledges still sometimes occurs – underscore the difficult path Tunisia is treading as it tries to both nurture the young democracy it founded after the 2011 revolution and simultaneously fight Islamist militants.
Like France, Belgium and other victims of Islamist bombings and attacks, Tunisia is trying to figure out how to protect people while also protecting their rights.
That process is even more difficult in a country where the security services themselves are trying to emerge from a history as abusers. As they take on the Islamists, there is a risk that police abuse will undermine the country’s democratic progress.
Rights groups such as Amnesty International and lawyers say cases of abuse at police detention, arbitrary arrests and torture have emerged, undermining the new democracy.
"When it comes to the war on terrorism, people say rights are taking a back seat," said lawyer Anouar Aouled Ali who has defended suspected militants.
The government said more needs to be done to stop it. In April, it set up an independent commission to prevent torture and other abuses, an initiative praised by the United Nations.
"We know there are cases of torture, but it is not systematic or a strategy. They are individual cases and we are working on them with civil groups so we can stop this type of abuse," said Justice Minister Omar Mansour during a visit to a women's prison on May 8.
Many of the inmates there were arrested under terrorism charges and have complained of beatings.
Few accuse Tunisia of a return to the worst days of its past when Zine El-Abidine Ben Ali's security services operated with impunity. Since the 2011 uprising ended his repressive regime, Tunisian civil society, rights groups and a free press have brought the state under scrutiny in a way never imagined under Ben Ali.
At the same time, the Islamist threat has many people calling for a harsh crackdown. Militants have struck three times since Bardo, gunning down tourists at a Sousse beach, dispatching a suicide bomber in Tunis and raiding a border town.
President Beji Caid Essebsi regularly tells Tunisians they are at war with militants trying to attack its democracy.
The laborer who was beaten by police, who told him he was a suspect because he lived in the same neighborhood as one of the Bardo gunmen, said such brutality left him fearful.
"I always heard about people being tortured, but never thought I would become a victim myself," he said.
There is little doubt Tunisia is at risk from militants. More than 4,000 Tunisians have left to fight for Islamist state and other groups in Iraq, Syria and Libya.
A state of emergency extended since the Sousse hotel attack in June has given state security wider powers to make arrests and detain suspects. A new anti-terrorism law has also extended the pre-trial detention period to 15-days.
Tunisia's army has made progress in counter-terrorism, in part thanks to training from Western nations such as border protection tactics. But police reforms have lagged behind and the government has brought back former Ben Ali officers to beef up its intelligence ranks.
"They bring knowledge in security in general and counter-terrorism," one senior Tunisian security official told Reuters. "Of course, abuses can happen, but the cases of mistreatment and torture are only individuals. All those cases that are proven, we punish them."
Tunisia's Human Rights Minister Kamel Jandoubi said his country is trying to get the balance between security and human rights, but acknowledges difficulties.
"How do you fight against a group seeking death and do it with the principles of rights? A society has to defend itself," Jandoubi said. "When we arrest someone, it is always with the principle of human rights."
Debate about Islam
Activists worry that even isolated security abuses will feed jihadist propaganda, especially because Tunisia is still struggling to fix the youth unemployment and economic malaise that helped trigger the 2011 uprising.
It does not help when cases of abuse are high profile, like the one involving Sofiane Melliti, a former professional footballer with a 2006 World Cup appearance and scores of international matches under his belt.
In late March, counter-terrorism forces stormed Melliti’s home and threw him in a Tunis jail where he said he was abused verbally, forced to kneel for hours, and accused of links to militants behind the attack on the border town of Ben Guerdane. Five days later he was released without charge.
"If this happened to me, someone relatively known, imagine what happens to those who don't have anyone to help them out," Melliti told Reuters. "Where are the rights, where are the authorities in all this?"
A police spokesman said he could not comment on the case.
While some activists fear the counter terrorism campaign will push certain groups toward the militants, others are worried it is reviving a debate about the role of Islam in one of the Arab world's most secular nations, where liberals jostle alongside conservative Salafists.
After the Bardo attack, some conservative young Tunisians began shaving off their beards and avoiding going to pray to evade police sweeps in poorer Tunis neighborhoods.
Mohammed, a conservative Tunis resident who works at a community center and as a representative for a European company, said police visit him after every attack to put him on administrative restriction — limiting his movements — though he has never been charged or jailed.
"Are they really fighting terrorism like this," he said.
Meanwhile, secular politicians such as lawmaker Walid Jalled are calling for a ban in public places on the full-face niqab veils saying militants use them to evade police.
"Don't think that the freedoms and rights we won in the revolution are going to disappear. No Tunisian would accept that," he said. "But we are in a delicate and sensitive phrase in the war on terror and we have to use what we must to win."