A former soldier has been sentenced under the Terrorism Act after he attempted to travel to Syria to fight Isis.

Robert Clarke came to the attention of police in July last year when it was believed that he was considering travelling to Syria, possibly to fight on behalf of Kurdish forces.

The 23-year-old from Wales was about to board a flight to Jordan at Heathrow Airport when he was detained and questioned by detectives, heard Westminster Magistrates’ Court.

He was handed a year-long community order for failing to give officers the pin number to his mobile phone when required to do so.

The verdict came shortly after it emerged that 20-year-old chef Ryan Lock was killed in Syria on 21 December – the third British man to die fighting Isis with the Kurds in the country.

After his arrest, Islamist extremists made “extremely nasty” threats towards Mr Clarke, who previously served four years in the Army, the court heard.

Ryan Lock was killed on 21 December, two months before he intended to return to the UK (Facebook)

Defence lawyer Korina Claire said Mr Clarke believed his intentions had been good and he had planned to go to Syria to “assist victims of war”, including by donating medical supplies that were in his luggage along with “military paraphernalia”.

She said he received “some extremely nasty threats from Islamic extremists or those purporting to be Islamic extremists” after he was charged.

Ms Claire added that once her client was remanded in custody she was contacted by a member of staff in prison, who said he was concerned about Mr Clarke's safety there “given that he had openly stated that he wished to fight against Isis”.

On 9 September, Mr Clarke told police officers who had visited him on several occasions that he was booked on a flight in four days time.

Prosecutor Louise Gray said he had been seen using an iPhone but refused to give officers his pin number after being detained.

He gave various reasons including that he had forgotten it, that it required fingerprint recognition and giving a number, which did not work, she said.

The court heard he still had not provided the correct number.

In pictures: Isis' weapons factories Show all 11 1 /11 In pictures: Isis' weapons factories In pictures: Isis' weapons factories A mortar round fin manufactured by Isis in Gogjali, Mosul, November 2016 Conflict Armament Research In pictures: Isis' weapons factories Isis rocket components discovered in Gogjali, Mosul, Iraq in November 2016 Conflict Armament Research In pictures: Isis' weapons factories Isis mortars discovered near Karamlais, Iraq, in November 2016 CAR In pictures: Isis' weapons factories An Isis rocket launch frame in Qaraqosh, November 2016 Conflict Armament Research In pictures: Isis' weapons factories A memo from Isis' COSQC on quality control at a manufacturing facility in Gogjali, Mosul, November 2016 Conflict Armament Research In pictures: Isis' weapons factories Electrically-operated initiators manufactured by Isis in forces Gogjali, Mosul, November 2016 Conflict Armament Research In pictures: Isis' weapons factories Isis mortar tubes at a manufacturing facility in Karamlais, November 2016 Conflict Armament Research In pictures: Isis' weapons factories An Isis mortar production facility discovered in Gogjali, Mosul, in November 2016 Conflict Armament Research In pictures: Isis' weapons factories An Isis weapons manufacturing facilities near Mosul in November 2016 Conflict Armament Research In pictures: Isis' weapons factories Stocks of French-manufactured Sorbitol, Latvian potassium nitrate and Lebanese sugar at an Isis weapons factory in Iraq Conflict Armament Research In pictures: Isis' weapons factories A destroyed Isis weapons facility in Qaraqosh, Iraq, November 2016 Conflict Armament Research

Mr Clarke will have to undertake 50 hours unpaid work as part of his sentence and is also banned from leaving the UK for the same period.

At an earlier hearing Mr Clarke, from Carmarthenshire, admitted wilfully obstructing an examination under the Terrorism Act on 13 September.

Sentencing him, District Judge John Zani said: “We live in difficult and potentially dangerous times and whatever frustration you felt has to be relaxed when you are asked to supply necessary information by the police officers merely doing their job.”

Dean Evans, 22, a dairy farmer from Reading, Berkshire, died in the city of Manbij in July last year and former Royal Marine Konstandinos Erik Scurfield, 25, from Barnsley, South Yorkshire, died in the northern village of Tel Khuzela in March 2015.

The Home Office has repeatedly warned that anyone travelling to fight in Iraq and Syria – for whatever side – can be prosecuted upon their return.

“Anyone who does travel to these areas, for whatever reason, is putting themselves in considerable danger,” said a Home Office spokesperson.

“Those who travel abroad in order to participate in conflicts may be committing criminal or terrorism offences and could face prosecution when they return to the UK.

“There are many crimes committed abroad – including murder – which courts in the UK can prosecute.”