The director of the BBC World Service has apologised for the offence caused by a debate on its website yesterday asking readers to debate whether gays should be executed.

In a statement published on the BBC Editors’ Blog today, Peter Horrocks apologised but added that it was a “legitimate and responsible attempt to support a challenging discussion”.

The debate was on Uganda’s proposed anti-gay bill, which could see gays and lesbians executed. A number of BBC online readers said the bill should be passed.

He wrote: “The original headline on our website was, in hindsight, too stark. We apologise for any offence it caused. But it’s important that this does not detract from what is a crucial debate for Africans and the international community.

“The programme was a legitimate and responsible attempt to support a challenging discussion about proposed legislation that advocates the death penalty for those who undertake certain homosexual activities in Uganda – an important issue where the BBC can provide a platform for debate that otherwise would not exist across the continent and beyond.”

One PinkNews.co.uk reader questioned why he had used the phrase “undertake certain homosexual activities”, saying: “What? Like window dressing and hair styling?”

Horrocks also told the BBC World Service’s Newshour programme today: “The main way in which people have responded to this is because the headline was extracted and circulated through social media and people responded to that. That is something quite new and its something we have to think quite carefully about, when things are taken out of context how do they seem,” he said. “We need learn from that and that is the change were are seeing.”

News of the debate quickly spread around Twitter yesterday afternoon, with readers asking whether the BBC would allow topics such as the extermination of Jews in World War II.

Yesterday afternoon, the BBC changed the question to ‘Should Uganda debate gay execution?’ after lobbying from BBC Pride, the state broadcaster’s LGBT society.

The debate was raised by parliament by Labour MP Eric Joyce, while Liberal Democrat MP Lynne Featherstone called on the BBC to apologise.

The National Union of Journalists has also attacked the BBC.

At an emergency meeting of the World Service news and current affairs chapel of the union late yesterday, it issued a statement saying the post was “overly sensationalist” and could encourage homophobia.