A 17-year-old boy who died trying to save a teenage girl in the sea off Whitby was on an outing from a secure psychiatric unit, it has emerged.
The pair were rescued along with another teenage girl after being swept out to sea off the beach on Wednesday.
James Samuel Willis, originally from Stockton, died at Scarborough Hospital. The girls were treated and discharged.
Northumberland, Tyne and Wear NHS Trust said all three were patients at St Nicholas Hospital in Gosforth.
It said the hospital is a medium secure psychiatric forensic unit for youths.
The unit cares for 14 to 17-year-olds who have either come into contact with the law as a result of their mental health issues, or are a risk to themselves or others.
Dr Suresh Joseph, medical director for Northumberland, Tyne and Wear Mental Health Trust, said there were four members of staff supervising the three teenagers on the trip.
He said: "The members of staff who accompanied them were in close contact with them all the time but unfortunately were not able to save the young man.
"Staff were keeping an eye on the teenagers."
A trust spokesman said: "We are all shocked and devastated by the news.
"We would like to offer our sincerest condolences to the family, friends and his fellow patients at this difficult time.
"We are fully co-operating with North Yorkshire Police to assist them in their investigation."
The RNLI said lifeguards noticed the pair in difficulty in the water. They reached the water's edge on a quad bike and entered the sea, reaching the girl first.
They then went further out to reach the boy.
They said it was thought the boy had managed to pull himself to safety using the ladder on the pier wall, but had returned to the water to help his companion.
Lifeboatman Hugh Ramsden said they tried to resuscitate the boy after recovering him from the water.
He said: "He was brought back to the Whitby lifeboat house and our coxswain took over CPR... until the emergency services arrived."
The RNLI said the third member of the group, another teenage girl, had managed to make it to shore alone.
Philip Rooks, who was at the beach with his children, said he was walking along the pier when his group noticed the teenagers were in difficulty.
He said they watched the boy swim to one of the girls who "was in real distress, shouting that she couldn't swim".
He added: "The poor lad managed to stay with her for a short time but after a couple of waves washed over him he turned in the water face down.
"At this point two lifeguards were swimming out against what I can only imagine being a strong current.
"Everyone started to shout to the young girl to turn her friend but you could see that she was struggling to survive herself."