A young Briton who died fighting alongside Kurdish forces in Syria killed himself to avoid falling hostage to Islamic State militants, an inquest heard.

20-year-old Ryan Lock, from Chichester, West Sussex, died last December fighting with the People’s Defence Units (YPG) in the northern city of Raqqa, considered to be Isis’ de facto capital.

Former chef Mr Lock, who had no previous military experience, joined the Kurdish militia after telling his family he was going backpacking to Turkey in August last year.

An inquest in Portsmouth, Hampshire, heard that after being surrounded by Isis fighters, he turned his gun on himself to avoid being captured and suffering a “frightening and painful death”.

In the months before he died, Mr Lock had kept in touch with his family via Facebook Messenger, sending them pictures and updates on his military training.

But after losing contact with him last December, Mr Lock’s father Jon Plater found images online of his son with an Isis fighter standing over his body, and his death was later confirmed, the inquest heard.

YPG general command member Mihyedin Xirki said Mr Lock, who used the nom de guerre Berxwedan Givara, was a “martyr” who died “putting up a brave fight”.

The British Foreign and Commonwealth Office (FCO) advises against all travel to Syria, saying the situation remains “extremely volatile and dangerous”.

Four Britons are believed to have died fighting Isis with the Kurds in Syria.

The latest was 22-year-old Luke Rutter, from Birkenhead, who died in Raqqa on July 5. In a final video message, he apologised for lying to his loved ones about going to fight.

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

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