A man who tried to kill officers with a crossbow was shot by police after a seven-hour siege.

Jamie Thomson fired the crossbow and launched fireworks during the stand-off at his flat in Kilbirnie, North Ayrshire.

The 25-year-old later said he wanted to write a letter in "favour" of the police marksman who shot him in the arm.

On Thursday, Thomson pleaded guilty to attempted murder when he appeared at the High Court in Glasgow.

The court heard the stand-off began in Bankfaulds Avenue at around 5.45am on March 12 this year.

When police attended his first-floor flat, they saw a topless Thomson stomping around his home with a number of large knives on the window ledge.

He initially hurled one of the weapons at police, before he shouted: "I'll chop your heads off. Bring it on. I will kill you."

Thomson, who also smashed windows, then launched fireworks from his home as back up was called for.

The court heard "a full firearms operation", including three armed response vehicles and police negotiators, arrived in a bid to subdue him.

Thomson called a former partner at one stage to tell her he was "getting ready" to be arrested or "taken from his home dead".

He continued to throw items at officers including glasses, cans, bottles, crockery, ice cream tubs and a games console.

Thomson barricaded himself in his property before firing bolts from his crossbow at several officers.

He was eventually shot in the arm at around 12.15pm, before being arrested and then treated for the wound.

After being arrested, Thomson said he wanted to write a letter in "favour" of the officer who shot him and stated there was "no need" for an investigation. Sentencing was deferred for reports.