Mourad Mosdefaoui was in possession of a phone with Islamic State-related images. Picture: AP

Algerian citizen Mourad Mosdefaoui, 34, who is thought to have entered the UK in 2008, put three posts on social networking site Facebook between September 2014 and March 2015.

In one, he is shown in a photograph holding a notepad with Arabic text which said: “The Islamic State will remain and expand God willing.”

In another, Mosdefaoui wrote he was troubled to be “living in a country of blasphemy” and appeared to suggest he would be willing to fight in Iraq and Syria. Investigators later found more than 11,000 images on a mobile phone in his possession, a number of which were said to depict imagery and propaganda associated with IS, including images appearing to show a beheading carried out by Jihadi John.

Sign up to our daily newsletter The i newsletter cut through the noise Sign up Thanks for signing up! Sorry, there seem to be some issues. Please try again later. Submitting...

A search of Mosdefaoui’s Edinburgh flat this summer also uncovered a forged Belgian identity card, which he said he had obtained in order to find work in the UK.

Details of the offences were revealed at Edinburgh Sheriff Court yesterday, where Mosdefaoui pleaded guilty to two charges – one under the Terrorism Act 2006 and one under the 2010 Identity Documents Act. Sentencing was deferred until next month.

Narrating the circumstances of the case, procurator-fiscal depute Calum Darling told the court: “The messages posted by the accused celebrate the terrorist acts of the Islamic State of Iraq and the Levant [Isil, another name for IS].

“The messages amount to encouragement of support for a proscribed group and may be inferred to encourage acts of terrorism generally.”

Mosdefaoui, a prisoner at HMP Edinburgh, lived in the city’s Granton Road before being detained.

The court was told he had applied for asylum in the UK in 2010, which was refused, and he subsequently exhausted his rights of appeal.

In 2012, his application for assisted voluntary removal from the UK was granted but later withdrawn as he had not attempted to leave the country.

The court heard how, on September 22 last year, he posted a single image of himself to Facebook on an account belonging to him but in a different name.

Mr Darling said: “The accused is depicted holding a notepad bearing Arabic text. The text translates as follows: ‘The Islamic State will remain and expand God willing’.

“This phrase is amongst the most famous and most widely disseminated slogans associated with the Islamic State of Iraq and the Levant.”

Mosdefaoui asked for people’s prayers and said: “The main thing that is troubling me is that I have been living in a country of blasphemy for a long time...”