A MAN who turned on police after his hammer-wielding neighbour targeted his home with his pregnant partner inside has narrowly avoided a prison sentence.

Graham Falconer — who once told officers they 'deserved' to be murdered in an American-style shooting — shouted and swore uncontrollably during the incident.

He has now been ordered to carry out work in the community as a punishment.

Lawyer David Tod told Greenock Sheriff Court: "He had found that his neighbour had tried to go through his door with a hammer, and his partner was in the house.

"The intensity of Mr Falconer's reaction was due to his partner being pregnant."

Falconer, 34, committed the offence at his home on Murdieston Street on June 22.

Prosecutor Saud Ul Hassan said: "The accused became abusive towards the police and he was arrested.

"He continued to shout and swear, calling officers a derogatory name and calling one of them 'speccy'.

"He was taken outside towards a cell van and a witness shouted down from an upstairs window in an attempt to calm him.

"The accused gathered saliva in his mouth and attempted to spit towards the witness."

Solicitor Mr Tod said: "Because of Mr Falconer's state of agitation the first person the police paid attention to was him.

"He felt some sense of umbrage at that.

"Mr Falconer accepted that he was going to be arrested, partly because he saw that his neighbour was arrested for going through his door with a hammer."

Falconer was jailed in July 2016 following a tirade of disgusting jibes and racist rants towards police.

He referred to a gunman who had recently killed police in the US city of Baton Rouge, and seethed: "Three cops to the chest — bang, bang, bang. That's what yous deserve."

Mr Tod told the court: "He has no matters outstanding. There has been a period of two years since he committed an offence.

"If someone had not come through his door with a hammer he would not have committed this offence."

Sheriff Thomas Ward placed Falconer on an electronic tag to remain at home between 7pm and 7am each day for three months.

He also ordered him to complete 135 hours of unpaid work within six months as a direct alternative to prison.