Media watchdog Ofcom has rejected complaints by West Midlands Police about a Channel 4 undercover programme that exposed extremism in British mosques.

Police claimed that the Dispatches programme had misrepresented the views of Muslim preachers and clerics in Birmingham with misleading editing.

Following today's ruling, the broadcaster called the police's actions "perverse" and said they had, in some people's eyes, given "legitimacy to people preaching a message of hate".

Ofcom said: "Undercover Mosque was a legitimate investigation, uncovering matters of important public interest. Ofcom found no evidence that the broadcaster had misled the audience or that the programme was likely to encourage or incite criminal activity.

"On the evidence (including untransmitted footage and scripts), Ofcom found that the broadcaster had accurately represented the material it had gathered and dealt with the subject matter responsibly and in context."

The programme featured undercover recordings from speakers alleged to be homophobic, anti-Semitic, sexist and condemnatory of non-Muslims.

Excerpts from preachers and teachers included "Allah created the woman deficient" and "by the age of ten, it becomes an obligation on us to force her (young girls) to wear hijab and if she doesn't wear hijab, we hit her".

Other statements included "take that homosexual and throw him off the mountain" and "whoever changes his religion from Al Islam to anything else - kill him in the Islamic state".

Police initially launched an investigation into whether criminal offences had been committed at the mosques and other organisations featured in the programme.

They then said that it considered offences may have been committed by those involved in the production and broadcast of the programme, specifically in stirring up racial hatred.

After the Crown Prosecution Service advised that the prospect of conviction was unlikely, police referred Undercover Mosque to Ofcom, complaining that intense editing had misrepresented those featured in the programme.

Ofcom also rejected the 364 viewers' complaints it received after the programme was broadcast, which it said appeared to be part of a campaign.

Channel 4 said it welcomed the Ofcom ruling. Andy Duncan, Channel 4 chief executive, said: "This is an important judgment that vindicates our strong defence of the programme in the face of a concerted effort to discredit it.

"We have maintained all along that the comments made by certain speakers in the film spoke for themselves and this ruling confirms that."

The documentary was produced by Hardcash Productions and aired as part of the Dispatches strand on January 15, Channel 4 said.  Kevin Sutcliffe, Channel 4 deputy head of news and current affairs, who oversees Dispatches, said: "This was a rigorous investigation conducted over nine months and involving great difficulty in its filming, substantial personal risk for the reporter and a great deal of considered judgment in the edit suite.

"All the preachers featured were offered a right to reply and none of these individuals complained to Ofcom about the way they were represented.

"In these circumstances it seems perverse that Hardcash and Channel 4 should have found themselves the subject of a police investigation.

"West Midlands Police acted in a calculated fashion - they made no attempt to discuss their concerns about the film with us in advance of going public with their complaint to Ofcom knowing that an allegation of 'fakery' would generate significant media interest.

"In the view of various commentators, their action gave legitimacy to people preaching a message of hate to British citizens and damaged the reputations of those involved in producing and broadcasting the programme."