A teenager who assaulted two schoolboys to get "one last fight before going to jail" has been sent to a young offenders institution for five years.
Paul Reynolds, 17, of Galashiels was branded a "danger to the community" at Selkirk Sheriff Court.
He led a gang of teenagers in the attack on two boys aged 14 and 15 in his home town in September.
The court heard he was awaiting sentence for trying to strangle his girlfriend at the time.
Reynolds, who saw himself as the leader of a gang of 14-year-olds, led a group chasing the two boys from the town centre for several hundred yards.
The court heard how they kicked, punched and stamped on their victims.
Both boys were taken to Borders General Hospital to be treated for multiple head injuries.
The 15-year-old was transferred to hospital in Edinburgh for specialist treatment for what was described as "bleeding in the brain".
Reynolds pled guilty to two charges of assault to severe injury with one of them being to the danger of life.
Sheriff Kevin Drummond said his starting point for the assaults was a seven-year sentence but reduced it due to his time already in custody and guilty plea.
He also imposed a further 12 months supervised release order at the conclusion of the sentence "in view of the danger he constitutes to the public".
Delivering sentence Sheriff Drummond said it was "perhaps fortuitous" that a life was not lost in the incident.
He continued: "This is not the first time that this court has been made aware of the violent activities of organised groups of young men in Galashiels.
"I have required to make it clear in the past that in appropriate cases these would be dealt with severely.
"In addition, when any assault includes kicking and stamping to the head it can be a matter of luck whether the consequences might range from fatal through to brain injury but they are seldom trivial."
Sheriff Drummond said he had considered remitting the case to the High Court for sentence but decided it could be dealt with at sheriff court level by using his sentencing powers "to their fullest extent".
He added: "This gratuitous unprovoked violence in the community by commonly drug and alcohol-fuelled young men cannot be tolerated.
"In the present case the state of mind exhibited by the accused by engaging in this behaviour in the full knowledge that he anticipated a lengthy jail sentence for his previous violence demonstrates, in my opinion, that he represents a danger to the community."
Reynolds, of Church Square, Galashiels, was already on three bail orders when he carried out the assaults.
The other teenagers involved are being dealt with by the Children's Hearing system.
Reynolds is currently appealing to the High Court about the length of the 49-month custodial sentence he received in October for trying to strangle his 15-year-old girlfriend.