A police officer suffered serious injuries when she was shot with a sawn-off shotgun by a man who then cycled off laughing and shouting "do you want some more, you pussies?", a jury has been told.
Pc Suzanne Hudson, 33, needed emergency surgery on arteries in her neck after the shooting and her right hand was left a "bloody and tangled mess", Leeds Crown Court heard.
Prosecutor Richard Wright QC told the trial of James Leslie: "It is simply a matter of luck that the defendant did not kill Pc Hudson."
Mr Wright said the 5ft 2in (157cm) Pc Hudson, 33, originally from Nelson, Lancashire, was "new to frontline policing, having been working in that role for a matter of a few days."
He said she and her colleague Pc Richard Whitely were investigating a report that Leslie had smashed a window in a dispute with some neighbours when she was shot at about 4.15am on December 4, last year.
The prosecutor said Leslie, 37, was behind the door of his flat and shot the officer after she knocked, through a frosted glass panel.
Mr Wright told the jury that Leslie left his flat on Cardigan Road, Headingley, Leeds, on a bike.
"He pedalled off up the road but again only after he had paused near to the officers, gun in hand, and shouted to Richard Whitely, who was tending to his injured colleague, 'do you want some more, you pussies?'," Mr Wright said.
He said: "Whilst Suzanne Hudson was badly injured and bleeding heavily, her partner Richard Whitely has escaped injury by virtue of being behind her and further down the stairs.
"He dragged her away from the flat and made a frantic call for help on his police radio."
The jury was played a recording of Pc Whitely's emergency call for help.
Mr Wright said: "On turning round he (Pc Whitely) could see immediately that she was badly injured. She was stumbling, her face was bloodied and her hand was very obviously and very badly injured.
"He grabbed hold of her and started to move her away from danger.
"She was gurgling and shouting his name."
He said: "He got as far as Cardigan Road itself when she collapsed to the floor. She was coughing and he was doing his best to clear blood from her mouth."
The prosecutor said the two officers did know the gun could not be fired again when Leslie followed them from the flat.
He said: "They both thought that the defendant might well shoot them again."
The prosecutor said Pc Whitely told Leslie to "f*** off "and that is what he did, making off on his bike, laughing and calling them pussies as he did so".
Mr Wright explained how, earlier, Leslie had repeated the word "police" to the officers after they first knocked at his door.
"He did it in what she described as a gangster or a street accent," he said.
"She did not think he was seeking clarification for who it was, she thought he was mocking her."
He said Pc Hudson was no more than 1ft (30cm) - "the length of a ruler" - from the glass when she was shot.
"Pc Hudson did not know what had hit her," he said.
"Everything seemed quiet apart from the ringing inside her head. She was disorientated but she did not appreciate that she had been injured.
"Pc Whitely grabbed hold of her and dragged her down the stairs and away from the door, back to the front of the building and away from the gunman.
"When she looked at her hand, she saw it was a bloody and tangled mess. But it was not until she heard her colleague transmit a radio message that she knew that she had been shot."
Mr Wright said Leslie was spotted by a member of the public in a branch of the Subway sandwich chain in Leeds, and arrested.
After he was taken to the police station, it was established that he had been diagnosed with schizophrenia.
The prosecutor said Pc Hudson was taken to Leeds General Infirmary.
He said she had "terrible injuries" to her hand and 80 pellets were removed from it.
Mr Wright said the officer's carotid artery and jugular vein had to be repaired by a surgeon.
Leslie has admitted possessing a prohibited weapon and causing criminal damage.
But he denies attempting to murder Pc Hudson and an alternative charge of causing her grievous bodily harm with intent. He also denies possessing a shotgun with intent to endanger life.
Mr Wright said that Leslie told interviewing police in a statement that the gun was not his, he did not know it was loaded, he did not know it was police at the door and that the weapon went off accidentally when the butt hit a worktop.
The prosecutor said: "We will invite you to say, having heard all of the evidence, that you can confidently reject it as deliberately contrived nonsense."
The trial was adjourned until tomorrow.