Iran has released a number of Pharrell Williams fans arrested in connection with a version of his hit song Happy made on the rooftops of Tehran.

It was not clear, however, if all of those involved had been freed.

Reihane Taravati, one of at least six people detained after uploading a video showing them dancing and singing to the song, said on a social networking site that she had been released.

The arrests, which caused outrage and made headlines across the world, prompted both Williams and Iran's president, Hassan Rouhani, to react. It also highlighted an internal row in the Islamic republic between Rouhani's administration, which favours internet freedom, and hardliners wary of relaxing online censorship.

Taravati and her friends were believed to have been released after lodging a large bail sum with the authorities, but it was not clear if they might later be put on trial.

On Tuesday night, Williams reacted to the news of the arrests on Facebook by saying: "It is beyond sad that these kids were arrested for trying to spread happiness."

Expressing gratitude for his support while they were in custody, Taravati posted on Instagram: "Hi I'm back thank you @pharrell and everyone who cared about us love you all so much and missed you so much." Another fan, Afshin Sohrabi, was also reportedly released, but some reports said the video's director, who has not been named, is still behind bars.

Iran's national TV aired the confessions made by a group of young Iranians involved in what Tehran's police chief described as an obnoxious video. They were talking to a state interviewer with their backs to camera. Activists condemned the programme as a common tactic of showing forced confessions misrepresented as interviews.

Rouhani, who had spoken a few days earlier about the importance of social networks, also tweeted in support of the fans.

"Happiness is our people's right. We shouldn't be too hard on behaviours caused by joy," a post published on Wednesday, quoted him as saying in June last year. Rouhani's reference to hapiness was no coincidence and although it did not mention the arrest directly, it was widely viewed as a reaction to the arrests.

Rouhani has not yet delivered on his promises of lifting the official ban on Facebook and Twitter, but he recently intervened when the authorities blocked access to the mobile messaging service WhatsApp and ordered the ban to be lifted. Such decisions are not entirely in his hands, but as president he has significant influence.

"Crime: happiness," said the title of a drawing by prominent Iranian cartoonist Mana Neyestani .

"If it is now a criminal act for youth to show their happiness in Iran, then law enforcement, and the hardline centres of power they represent, must really be running scared," said Hadi Ghaemi of the International Campaign for Human Rights in Iran.

"It is outrageous that citizens are subjected to this kind of intimidation and violation of their basic right to freedom of expression. They were breaking no law. It is sheer thuggery," he said.