A young Briton who died fighting alongside Kurdish forces in Syria killed himself to avoid falling hostage to Islamic State (IS) militants, an inquest heard.
A coroner said Ryan Lock, 20, from Chichester, West Sussex, died a hero last December fighting with the People's Defence Units (YPG) in the northern city of Raqqa, considered to be IS's 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 wounded and surrounded by IS fighters, he turned his gun on himself to avoid being captured and suffering a "frightening and painful death".
Recording a narrative verdict, Portsmouth and South East Hampshire coroner David Horsley said Mr Lock had sustained a leg wound that left him at risk of falling into the hands of a "cruel and ruthless" enemy.
Mr Horsley said: "He was not prepared to let that happen and used his own weapon to avoid capture. That can only be viewed as a brave action."
The coroner described Mr Lock as a "heroic young man" and added: "He died doing something he quite clearly believed passionately in."
In the months before he died, Mr Lock had kept in touch with his family from Syria via Facebook Messenger, sending them pictures and updates on his military training.
But after losing contact with him, Mr Lock's father Jon Plater found images online of his son with an IS fighter standing over his body, and his death was later confirmed, the inquest heard.
Pathologist Dr Basil Purdue said Mr Lock's cause of death was a single gunshot wound to the head.
Mr Lock flew from Luton to Istanbul on Flight KK6004 on August 24 before boarding a connecting flight to Iraq.
Mr Lock's mother, Catherine Lock, told the inquest how her son had given few clues about his intentions to fight IS in Syria.
She recalled him remarking how bad the situation was in Syria after watching a television news item.
But Ms Lock said: "It wasn't something he would constantly comment on, but he was quite a quiet person.
"He could be quite sheltered, and he would be quite careful what he said."
Ms Lock said her son only revealed a few days beforehand that he was intending to go travelling - but kept secret his plan to head to Syria with the YPG.
She said: "He just said that he had planned this for ages and that he had time off work. He said he would be going for a few weeks, maybe a month.
"And when I found out he was going to Turkey I said, 'You do realise that's right next to Syria where there is a war'.
"I hadn't twigged that was exactly his plan, to head to Syria."
Ms Lock said her son became secretive before he left home and spent a lot of time on his computer - and unusually tidied his room.
"That was one of the things that I really questioned," she continued.
"I actually said, 'Are you planning on coming back because you have spring cleaned your room?'.
"Deep down, there were things setting off alarm bells but I wasn't getting the answers."
Mr Lock had been in Turkey for about a day when he contacted his mother revealing he was going to Syria with the YPG, which she initially interpreted as a joke.
Ms Lock said: "I remember sending him a message saying that's not even funny, and he said it was true. That's when I absolutely panicked."
She said her son tried to reassure her by saying the YPG needed a chef and that he wanted to become a medic.
She also tried not to be negative for fear of him severing contact, adding: "I remember saying to him, 'I'm proud of you but for God's sake come home safely'."
Ms Lock said she maintained contact with her son once a week or once a fortnight via his pay-as-you-go phone but he did not disclose that he was involved in combat.
She revealed the last contact she had with her son was last December 6, and as days passed without hearing from him, an American journalist informed her of fatalities in Syria.
Amid panic and worry, Mr Plater later came across images clearly showing their dead son on an Arabic website. Mr Plater said: "You could tell straight away it was him."
He added: "I phoned the YPG a few times to see what was going on, and I spoke to Ryan's commander who said that he was surrounded and that he shot himself."
Ms Lock said she had no respect for the YPG, saying: "I've always been angry towards the YPG because if it wasn't for them, Ryan wouldn't be dead.
"They helped him to get to Syria. He would never have been able to get there on his own. From what I gather, it had been planned for quite a long time."
Dozens of people, including members of the Kurdish community, held roses and framed pictures of Mr Lock at Heathrow Airport as his body was repatriated to the UK in February.
Supporters of the YPJ female fighting force said his "memory will forever live on in our struggle for the freedom of Syria and our hope for change in the whole world".
And 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 inquest heard that following his death, a letter was passed to Mr Lock's family by someone called AJ Woodhead.
Believed to be a Canadian, he is thought to have travelled to Syria to fight alongside Mr Lock and the YPG.
In the letter, AJ Woodhead, who British police have been unable to trace, said Mr Lock "died a true hero" and that in any other war he would have received a medal.
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 IS 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, Mr Rutter apologised for lying to his loved ones about going to fight.
Dean Evans, 22, a dairy farmer from Reading, Berkshire, died in the city of Manbij in July last year and ex-Royal Marine Konstandinos Erik Scurfield, 25, from Barnsley, South Yorkshire, died in the northern village of Tel Khuzela in March 2015.
Mr Lock's parents declined to comment following the hearing.