West Midlands Police and the Crown Prosecution Service has publicly apologised and paid a six-figure sum for accusing a Channel 4 documentary, exposing extremism in Britain's mosques, of misleading editing.

The apology was made at the High Court following Channel 4's decision to launch libel proceedings against police and the CPS.

A press release issued by police and the CPS last year claimed that the Dispatches programme misrepresented the views of Muslim preachers and clerics with misleading editing.

Police reported Channel 4 to TV watchdog Ofcom for "heavily editing" the words of Islamic imams to give them more sinister meaning in Dispatches: Undercover Mosque.

The programme investigated several mosques including Green Lane Mosque, in Small Heath. Abu Usamah, one of the preachers f r o m Green Lane who was featured in the programme, said he was shocked when he saw himself depicted.

"It was the fact that Green Lane Mosque has a 33-year-old tradition of preaching and teaching the moderate version of Islam," he said at the time.

In August last year, confirming the force had made a formal complaint to the broadcasting watchdog, Assistant Chief Constable Anil Patani said: "The priority for West Midlands Police has been to investigate the documentary and its making with as much rigour as the extremism the programme sought to portray."

Ofcom rejected the complaints in a decision published last year. Police had suggested they had considered taking action against Channel 4 before being told the prospect of conviction was unlikely.

Around £14,000 was estimated to have been spent by police on the investigation, which was initially looking at whether three of the individuals shown in the programme could be prosecuted for inciting terrorism or racial hatred.

But they then announced offences may have been committed by Channel 4, specifically in stirring up racial hatred.

Police also claimed the programme undermined "community cohesion" and "feelings of public reassurance".

Programme excerpts from preachers and teachers included "Allah created the woman deficient" and "by the age of 10, 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".

One speaker in the programme was shown glorying in the Taliban's murder of a British Muslim soldier in Afghanistan, saying the real hero was "one who separated his head from his shoulders".

Kevin Sutcliffe, deputy head of current affairs at Channel 4, said of today's announcement: "Channel 4 was fully aware of the sensitivities surrounding the subject matter but recognised that the programme's findings were clearly a matter of important public interest.

"The authorities should be doing all they can to encourage investigations like this, not attempting to publicly rubbish them for reasons they have never properly explained."

David Henshaw, executive producer and managing director of Hardcash Productions, who produced the documentary, said: "This was a thorough and detailed one-hour documentary, made over nine months and at personal risk to the undercover reporter."

A police spokeswoman confirmed: "An apology is being read out in open court and a sum has been agreed to programme makers for a charity of their choice."

Channel 4 said £50,000 would be donated to the Rory Peck Trust for freelance news gatherers and their families in times of need. It will also receive £50,000 in costs.

A statement to be made in open court will say "both defendants now accept that the allegations of distortion that were made in the press release were incorrect.

"They are here by their counsel today publicly to withdraw these allegations and to apologise for the fact that they were made."

It will also say: "As an indication of the sincerity of this apology and as recognition of the seriousness of allegations of fakery for professional journalists and broadcasters, both defendants have agreed to pay substantial damages to the claimants and to pay their legal costs.

In a statement issued on its website, West Midlands Police apologised to the programme makers and also accepted the findings of the Ofcom inquiry. The statement read: "On 8 August 2007 we published, jointly with the Crown Prosecution Service, a press release relating to the Channel Four Dispatches programme Undercover Mosque.

"This press release alleged that footage of the speakers shown had been so 'heavily edited' and taken out of context that it had 'completely distorted' their meaning.

"Reference was made to the CPS having been asked to consider instituting proceedings against those involved in making the programme for inciting racial hatred.

"Following an independent investigation by the broadcasting regulator Ofcom, we now accept that we were wrong to make these allegations.

"We now accept that there was no evidence that the broadcaster or programme makers had misled the audience or that the programme was likely to encourage or incite criminal activity."

The statement added that a review of the evidence gathered by Ofcom had demonstrated that the programme had accurately represented the material it had gathered and dealt with the subject matter responsibly and in context.

"We accept, without reservation, the conclusions of Ofcom and apologise to the programme makers for the damage and distress caused by our original press release," the statement concluded.