Alexander McBride, 17, was previously warned by Sheriff Simon Pender to be of good behaviour after a string of offences including resisting arrest and assaulting a police officer.

But McBride ran out of chances last week when he admitted threatening his brother and mother with the weapon.

Dumbarton Sheriff Court heard how on June 19, McBride was in the family home on Lineside Walk, Rhu, with his mother and brother, who was looking for an iPad but could not find it.

He asked McBride if he had the tablet device, who told him he didn’t, which led to an argument during which McBride became aggressive.

Isobel Martin, prosecuting told the court: “He was shouting and swearing at his brother and said he was going to ‘knock his head off’.

“At that time he was at the top of the stairs and his mother was getting ready to leave for work and his brother was getting ready to go into town.

“McBride was shouting at both of them saying he was going to ‘batter’ them.” It was at this point his brother became aware of McBride holding something behind his back that he identified to be a yellow handled hammer.

As his brother and mother left the house, McBride shouted: “I will smash your head in and knock you out.” They went to Helensburgh police station to report the matter, where McBride handed himself in at 1am the next morning.

Scott Adair, defending, told the court a report filed in May this year showed McBride has a problem with alcohol.

He also said that by handing himself into police, he had gone against a restriction of liberty order.

Mr Adair added: “He left the family home after this incident and has been told he has an address in Glasgow and one in Oban that he can stay at.

“But he is well aware that it is unlikely to be able to use those and now he faces his first custodial sentence.” McBride had previously been put on a restriction of liberty order and a community payback order in relation to a number of charges, including resisting arrest and struggling violently with officers after being arrested in April.

In the same incident in Helensburgh, he also spat on the face of a police officer.

Previous to this, he was also arrested after an incident at the Co-op store on Sinclair Street, Helensburgh in January.

That was after he assaulted a police officer, attempted to punch him, before knocking him to the ground and tried to spit on him.

Sentencing, Sheriff Pender said: “It was made abundantly clear when the community payback order was made that if you offended further, or if I had concerns about your progress, you would be going to jail. You have re-offended.

“You are clearly out of control. You have chosen not to take advantage of the considerable chances you were given.

“Only custody is appropriate, especially in light of one of the charges, assaulting an officer.” He was jailed for nine months.