A man has admitted posting online messages in support of the so-called Islamic State (IS) and their terrorist acts.

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

In one, he is shown in a photograph to be holding a notepad with Arabic text, translated as: "The Islamic State will remain and expand God willing."

In another, he 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.

Officials 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 the man known as Jihadi John.

A search of Mosdefaoui's Edinburgh flat this summer also uncovered a forged Belgian identity card, which he admitted owning in order to find work in the UK.

Details of the offences were revealed at Edinburgh Sheriff Court today, 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.

"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."

When interviewed by police later, the accused said the image was created for a friend as a joke.

On September 24, he posted a second image, this time depicting IS leader Abu Bakr al-Bagdhadi.

One translation of the Arabic text on the image read: "The Face has succeeded, Successor of the Muslims, The prince of believers."

Almost six months later, Mosdefaoui put a further image on the social networking site, which 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.

"Most people might be busy looking after their jobs, cars or businesses but, believe me brothers, I am very scared that God will replace me and not use me to defend his religion and the honour of the virtuous girls in Iraq and Syria."

Mr Darling said: "In the message the accused appears to suggest that he would be willing to fight in Iraq and Syria."