Six Iranian youngsters arrested after uploading video of them dancing to Pharrell Williams' song 'Happy'

. Credit: .

Six young Iranians have been arrested and forced to apologise on state television after posting a video online of them dancing to Pharrell Williams' song 'Happy'.

Three men and three unveiled women were seemingly joining in with the global trend of dancing to the song and uploading the video to YouTube.

Young people in 140 countries have reportedly also joined in with the craze which is seen as acting with defiance in a country where there are tense conditions.

Pharrell took to Twitter and said it was "beyond sad" that the six youngsters were arrested.

On state television the six Iranians said they did not know the footage would be broadcast and the detainees "confessed to their criminal acts", according to The New York Times.

Footage shown on state television showed the six being interrogated by police and an officer calling the video a "vulgar clip which hurt public chastity".

Police also warned Iranian youngsters not to be "seduced" by viral video filmmakers and officers boasted it had taken them only hours to track down the six people - despite the clip being uploaded to YouTube over a month ago.

In an interview with news site IranWire last month, one of the dancers claimed that the unveiled women had worn wigs to conform with the country's Islamic dress codes.

A dancer claimed the women had all worn wigs. Credit: YouTube / Pooya Jahandar

Since the 1979 revolution in Iran - when Islamic law was imposed - women must cover themselves from head to toe.

The YouTube clip uploaded by the six Iranians had over 165,000 views before it was made private after attracting interest from the police. Another version has now been put on the site.

The YouTube clip was viewed over 165,000 times before it was made private. Credit: YouTube / Pooya Jahandar

The arrests come after Iran's president Hassan Rouhani said in a speech at the weekend that his country should embrace the internet.

His official English Twitter accounted posted:

He said: "We must recognise our citizens' right to connect to the World Wide Web".