An episode of the spy drama Spooks that attracted almost 1,000 complaints to the BBC has been cleared by a TV watchdog.

Shown in June, the story centred on a suicide bomb school in a Birmingham mosque and was condemned for showing Islam in the UK in a bad light.

But 43 complaints made to the Broadcasting Standards Commission (BSC) have been dismissed.

The show was "clearly presented as a drama, rather than as a factual account", the regulator said.

Muslims groups said the programme's plot could have incited hatred towards Islam.

The BSC's report acknowledged that the programme "appeared to be an affront to their faith and dignity".

The commission... did not consider that the programme was calculated to encourage Islamophobia

Broadcasting Standards Commission

It expressed "sympathy" with those who were upset and had "reservations" about its timing, coming soon after the war in Iraq.

But there were "sympathetic" Muslim characters in the episode and the show was obviously not factual, it said.

"The commission accordingly did not consider that the programme was calculated to encourage Islamophobia, or suggested that followers of Islam were prepared to resort to violence to further their own ends," it said.

Birmingham Central Mosque was defaced after the programme was first shown, with the slogan "Suicide bombers inside - kill the bombers".

The BBC apologised for its "Cliffhanger" trailer

West Midlands Police said there was no evidence that the attack was linked to the programme.

Spooks, based around a trio of MI5 agents fighting terrorism in the UK, is currently in its second series.

In a separate report, the BBC has revealed that it received 645 complaints from April to July, 312 of which were upheld.

The high proportion of upheld complaints was down to one trailer, screened in May, which featured a woman falling over a cliff.

BBC Director General Greg Dyke said: "We immediately recognised we'd made a mistake, withdrew the trail the next day, and issued a statement apologising for the upset it had caused."