A court heard surgeons had to carry out the emergency operation to save the man after he was stabbed in the chest by Leighton Wood outside Mook Bar.
Leeds Crown Court was shown on CCTV of the incident outside the bar as Hirst’s Yard was busy with August revelers.
Wood, 27, of no fixed abode, is on trial for attempted murder.
He also pleads not guilty to another charge of unlawfully wounding with intent to cause grievous bodily harm.
The jury heard how the stabbings took place after Benjamin Kelly punched Wood because he feared attacking his friend with the weapon.
Stephen Wood QC, prosecuting, said the accused backed off and ran into Mr Kelly’s friend before words were exchanged between the two men.
The prosecutor said: “When Benjamin Kelly tried to intervene, the defendant said he had to stay out of it and was going to ‘stab his mate’.
“Fearing that the defendant would carry out this threat and in order to protect his friend, Mr. Kelly punched the defendant, forcing him to move away from his friend.
“Mr. Kelly hit him several times.
“The prosecution suggests that when he said this to Mr. Kelly, the defendant already had the knife drawn in his right hand.
The “cruel” father Alan Bird must serve at least eight years in prison for having murdered him…
“We suggest he had already removed the knife from his right pocket.
“With the knife he aimed at Mr. Kelly’s chest and he stabbed him twice.”
The prosecutor said the first shot was aimed at his heart and the second shot was on the left side of his abdomen.
Mr Wood continued: “The prosecution said that when he stabbed Mr Kelly in the heart, he intended to kill.
“What other intention could a person have when stabbing someone in such a vulnerable area?
“What he did could not be reasonable self-defence of himself and was therefore an unlawful assault on Mr. Kelly.”
The court heard that Mr Kelly put his hands on Wood’s shoulders moments before the incident and said: ‘Relax mate. No need to go crazy or act like that.’
The prosecutor said: “You may think Mr Kelly was trying to defuse the situation.
“The defendant should not be calmed down.
“He told Mr. Kelly not to get involved and that he was going to ‘do it’, stab Mr. Kelly’s friend.”
Mr Kelly did not realize at first that he had been stabbed, but soon had difficulty breathing and began to pass out.
He left the scene in a taxi to go home with a friend.
Mr Wood said: ‘It became clear that Mr Kelly was in a perilous condition and the taxi took a detour to the hospital.
A CT scan at the hospital showed he had suffered a “devastating” injury that was straining his heart.
Mr Wood said: “If he hadn’t arrived at the hospital when he did and if the medical staff hadn’t acted so quickly, Mr Kelly would have died.
“There’s no way he would have survived without immediate surgery.”
The court heard the defendant had already pleaded guilty to a possession of an offensive weapon offense in the incident on August 30 last year.
The prosecutor told the jury: ‘We anticipate that the issue for you in this case is whether this defendant may have been acting in self-defence when he stabbed Mr Kelly in the manner we have just seen .”