The man she walked with and two of his peers were detained, beaten and ordered to sign statements promising not to engage in immoral activities, said the woman and one of the men.
The incident was the first known case of Hamas openly trying to punish a woman for behaving in a way it views as un-Islamic since seizing power two years ago. But it follows months of quiet pressure on Gaza's overwhelmingly conservative 1.4 million residents to abide by its strict religious mores.
Hamas officials in Gaza have publicly urged shopkeepers to take down foreign advertisements showing the shape of women's bodies and to stash away lingerie often displayed in windows. Officials search electronic shops to check if they are selling pornography on tiny flash drives.
"There's an open, public program to preserve public morals in Gaza," said local rights activist Isam Younis. "In reality that means trying to restrict freedoms."
Hamas denies any crackdown is under way. Since taking power, it has said it would only try to lead by example and not impose its views on anyone.
However, the group has taken no public action against small, shadowy groups that have attacked perceived hotbeds of Western immorality, such as hairdressers and Internet cafes, fueling criticism that it has not been tough enough on hard-line Muslim groups.
Freelance journalist Asma al-Ghoul says a group of Hamas police sent a clear message that certain behavior would not be tolerated when she went to the beach one evening in late June.
Al-Ghoul, 26, said she was spending time with a group of friends - two women and three men - on the northern Gaza shore.
Al-Ghoul is fairly exceptional in Gaza because she does not wear a Muslim headscarf. On that evening she wore jeans and a T-shirt - dress that is considered fairly provocative in Gaza's conservative society and which could have easily attracted the attention of the plain-clothed Hamas vice police who patrol the beaches.
Al-Ghoul swam, fully dressed, with a girlfriend, and then asked a male friend to walk her over to a nearby beach house rented by another couple she knew to shower and change.
Three policemen showed up and waited for al-Ghoul in the beach house garden, said an eyewitness who asked to remain anonymous because of security concerns. They took her identity card and demanded she accompany them to a nearby station - an order she refused.
An argument ensued and she was able to avoid detention and get her identity card back only after the homeowner contacted a senior Hamas official who intervened and spoke to the officers by telephone. The official, Taher Nunu, was not immediately available for comment.
The eyewitness said the police did not say why they wanted to detain al-Ghoul, but were insinuating that her behavior was unbecoming. Under Hamas' strict interpretation of Islamic law, a woman should not go out in public with men who are not related to her.
However, al-Ghoul said her male friends were subsequently beaten by Hamas police, detained for several hours and asked to sign statements saying they would not "violate public moral standards again," she said.
Al-Ghoul said she mostly felt angry that the police made her feel like she had done something wrong.
"I'm not provocative and my dress isn't provocative, and I'm not scandalous either," she said.
Her story only became public after rights groups published excerpts on their Web sites. Her version of events was confirmed by two other witnesses, including Adham Khalil, one of the men who was detained. Khalil said he was beaten.
Hamas police spokesman Islam Shahwan denied the incident took place but said Gaza residents "must preserve our customs and Islamic traditions."