Francis Mackenzie felled Gerald Kenney with a two-handed hammer blow to the head before he and others continued to assault the victim on the ground.
Mackenzie, who suffers from post traumatic stress disorder following an assault on him, continued to rain down blows on Mr Kenney with the weapon.
He repeatedly struck him on the head and one eyewitness saw the victim's skull give way.
The victim had been walking the dog along Maukinfauld Road, in Glasgow, before turning into Tollcross Road when he was approached from behind by his assailants.
A judge told Mackenzie at the High Court in Edinburgh he was satisfied he should make an Order for Lifelong Restriction in his case.
Lord Turnbull said: "You are an adult man with a lengthy history of criminal conduct which includes a number of convictions for assault."
Lord Turnbull ordered that Mackenzie must serve three years and nine months before he becomes eligible to apply for release on parole. If freed by parole authorities he will be under continuing supervision.
But the judge told him: "Whether you will ever be released from custody on licence and, if so, at what point will be a matter exclusively for the Parole Board of Scotland, and not for the court," he said.
Mackenzie, 47, who has a previous conviction for culpable homicide, had earlier admitted attempting to murder Mr Kenney in the attack on June 12 last year at Tollcross Road in Glasgow.