A man who threatened a police officer while armed with a knife, the day before the funeral of his four-year-old stepson, was spared a jail sentence.

Judge John Potter told 30-year-old Ryan Heffernan that threatening people with a knife would normally pass the custody threshold, but there were exceptional circumstances in his case.

Prosecutor Philip Adams told Bradford Crown Court yesterday there was a sad background to events. He said the defendant’s stepson had died on November 10 last year and the funeral was to take place four days later.

Mr Adams said that on the evening of November 13, Heffernan phoned his sister-in-law. It was clear he was very unhappy that her partner would be attending the funeral.

“The defendant made a number of abusive and insulting comments which caused her upset,” Mr Adams said. “Later that evening he sent a text message to her in similar terms.”

Later police were called to the defendant’s home after an incident involving other family members. Heffernan opened the door but immediately slammed it shut when he saw the officers.

They saw that he had picked up a knife and was holding it, and one of the officers entered the property through the back door.

Mr Adams said: “As he did so, the defendant ran towards him and shouted: ‘Get out of my house or I will stab you.’ He was holding the knife. The officer immediately withdrew.”

The officer armed himself with his Taser, reopened the door and instructed the defendant to put down the knife.

Mr Adams added: “The defendant immediately dropped the knife. He became upset and remorseful, in floods of tears, and stated that his baby son had died.”

Heffernan, of Sunnyside Lane, Wapping, Bradford, pleaded guilty to harassment and affray.

Judge Potter imposed a 12-month community order, with supervision and a high intensity activity requirement.

The judge told Heffernan: “I accept emotions were running high at the time. That does not provide an excuse to cause further harm by being abusive, nor to behave as you did when police attended your property.”