Hamas officials said today that a British freelance journalist detained in Gaza will be held for 15 days, an unprecedented step against a foreigner since the Islamist group took control of the territory in 2007.

The documentary filmmaker Paul Martin was detained yesterday at a military tribunal where he was to testify on behalf of a Gaza man accused of collaborating with Israel, said the Hamas interior ministry spokesman Ehab Ghussein. He had just begun to give evidence when the prosecutor intervened to say that Martin was wanted in the case and ordered police to arrest him, according to Ehab Jaber, the lawyer for the accused.

"The policeman put the handcuffs on him, and took him out of the court to prison. They were rough with him," said Jaber, who witnessed the scene.

Ghussein said Martin, who has produced reports in the past for the BBC and the Times, was suspected of harming Gaza's security. He said the order to detain him for 15 days was based on a confession by a suspected collaborator with Israel, an apparent reference to the man on trial.

Martin had met with British consular officials since his arrest, he added.

A spokeswoman for the British consulate in Jerusalem said the British government was "very concerned" and has been in touch with Martin's family. Raji Sourani, a prominent human rights lawyer in Gaza, said he was asked by Martin to represent him and would meet the journalist later today.

Martin's colleagues called for his immediate release. "We expect Hamas, as we do all parties, to respect the rights of every journalist on assignment to work without fear of being arrested," said the Foreign Press Association, which represents journalists covering Israel and the Palestinian territories.

Since Hamas took control of Gaza from the western-backed Palestinian president, Mahmoud Abbas, nearly three years ago, it has carefully avoided confrontations with foreign visitors, particularly journalists. It has also tried to reach out to the west in the hope of ending the Israeli blockade of the border with Egypt.

The Gaza interior ministry said foreigners were welcome in Gaza, but "anyone who tries to violate the security of Gaza will be held accountable".

Ahmed Yousef, a Hamas official, said Martin "is being detained for clear security reasons, and it is nothing to do with his job as a journalist or [him being] a westerner".

The chain of events began yesterday when Martin went to the military court to speak on behalf of Mohammed Abu Muailik. Jaber said Martin had been working on a documentary about Abu Muailik, who has been in detention since June.

A spokesman for a Gaza militant group, the Abu Rish Brigades, said Abu Muailik was a former member. The group is a violent offshoot of Hamas's rival Fatah, the movement led by Abbas.