This article is the subject of a legal complaint made on behalf of Sheikh Sadeg Elgariani.

Libya's highest spiritual leader, the grand mufti Sheikh Sadik Al-Ghariani, helped orchestrate the Islamist takeover of Tripoli from the UK, the Guardian has learned.

On a day when David Cameron announced tougher measures to tackle the threat from terrorists, the Foreign Office confirmed that Ghariani was residing in the UK, from where he is encouraging his followers to overthrow the Libyan government.

Earlier this week, the radical cleric celebrated the violent capture of Tripoli by Islamist militia force Libya Dawn and called for a widening of the rebellion on Libyan TV.

The day after Tripoli fell to the Islamist group Libya Dawn, Ghariani sent congratulations to the Islamist militants via Libya based Tanasuh TV: "I congratulate the revolutionaries in their victory, I give blessing to the martyrs," he said.

Ghariani's presence in Britain will prove acutely embarrassing for the government, emerging on the day the prime minister warned of a "greater and deeper threat to our security than we have known before" from Islamist extremists as the security threat level was raised from substantial to severe.

Smoke fills the sky over Tripoli: rival militias have been fighting since mid-July in the capital for control of the city's main airport. Photograph: EPA



Libya is enduring its worst violence since the 2011 overthrow of Muammar Gaddafi, after Libya Dawn, an alliance of Islamist forces, swept into the capital last week, burning homes and arresting opponents as the government fled to eastern parts of the country.

Libya Dawn does not accept the elected parliament, the House of Representatives, which is recognised as Libya's legitimate government by the United Nations and the international community. Instead, Libya Dawn supports the former parliament, the General National Council, based in Tripoli.

The shadow immigration minister, David Hanson, said: "The home secretary has serious questions to answer about how the Home Office has decided that his presence here will be beneficial to the UK."

Hanson said Ghariani's time in Britain was a further illustration of the Home Office failing to share intelligence with the Foreign Office and MI5. He added: "Instead, there are very serious allegations about someone that has been given permission to enter the country and the home secretary needs to explain how he was able to travel here and continue to seemingly instigate action in Tripoli."

Ghariani also communicates with his supporters through an Arabic-language website, Tanasuh.com, set up by his son, Sohayl Elgariani, and registered to at a rundown block of private flats in Exeter, next to a tanning salon and a short walk from Exeter City's football stadium St James Park. Elgariani failed to return requests for comment.

In a sermon earlier this week, the radical cleric called for a widening of the violent insurrection in Libya, encouraging "revolutionaries" to target Bayda, the home of the government, and Tobruk, where parliament has fled to. "I call on cities like Tobruk and Bayda who did amazing work in the revolution … to join their brother revolutionaries in Libya so that they have one united way," he said.

In a direct threat to the west not to intervene in the latest outbreak of violence, Ghariani appeared to refer to the UK, France and the US – leaders in Nato's 2011 intervention in the Libyan revolution – when he said: "The countries that helped the revolution of 17 February … your gamble must be with the people, not with the rulers."

Libya's prime minister, Abdulah al-Thinni, this week railed against the broadcast, accusing the grand mufti of issuing "false fatwas", and urged parliament to sack Ghariani from his quasijudicial post.

Since being appointed two years ago, the mufti has often courted controversy, siding with radical Islamist factions and issuing fatwas including banning Libyan women from marrying foreigners and urging the government to regulate the import of lingerie.

"The mufti has always been a disruptive element," said Hassan el-Emin, a former Libyan politician who fled to Britain after receiving militia death threats. "This guy has been here in Britain inciting this kind of stuff."

A Foreign Office spokesman confirmed that Ghariani was in the UK: "He wasn't invited by us. Our understanding is it's a private visit."

The Home Office said: "We do not routinely comment on individual cases. But we are clear that those who seek to foster hatred or promote terrorism are not welcome in the United Kingdom. We will take action against those who represent to our society or seek to subvert our shared values. All cases are kept under review."

• Lawyers for Sheikh Al-Ghariani contacted us after publication, in July 2015, taking issue with this article. They stated that he stands against terrorism, violence and religious extremism and has called for unity in Libya. They say that events described as 'the Islamist takeover of Tripoli' in fact constitute the rescue of Tripoli, under the authority of the General National Congress, from unlawful forces loyal to General Haftar. They also pointed out that Sheikh Al-Ghariani's speech of 24 August 2014 was broadcast via a Libyan TV station called Tanasuh TV, not via a website called Tanasuh.com. The article has been amended to correct this, as well as to include further political background and to reflect that a potential war crimes investigation referred to did not come about.