In the book "Returning to Silence" by Dainin Katagiri, a poem is presented written by a Japanese surgeon Senri Ueno one week before being executed for war crimes. What is known about Senri Ueno? It is explained in the book that he attempted to save the life of an American pilot, only to find the pilot stabbed to death when he left the patient unattended, and was executed for the murder.
Navy Commander Ueno Senri (AKA Ueno Chisato), chief medical officer, 41st Naval Guard Unit. He was hanged on Guam on March 31, 1949 at the age of 43. He was from Yaita, Tochigi.
So, the version of the story in the book you read (and which is included a number of Buddhist books) comes from a book called Seiki no Isho that was published in 1953 by a group of prisoners as Sugamo Prison (which the Allies used to hold those convicted of or awaiting trial for war crimes). They had issued a call asking the families of those who had been executed for war crimes, committed suicide, or died in prison to send them copies of their final writings. They then edited these and had it published. The year of publication is significant as the military occupation of Japan ended in 1952. As you can imagine, everyone involved in this project was rather sympathetic to those who had died or been executed.
The version presented at trial was much less kind to Ueno. Namely, he was accused of executing two POWs on Truk in June 1944 after they had been injured in an Allied air raid. He allegedly had one stabbed to death with a bayonet. The other, he is supported to have performed a vivisection on before ordering that he be beheaded. Ueno did not deny that he had ordered the executions. His defense was that both were beyond saving and that these had been mercy killings. He also said that he had been conducting legitimate surgery, not a vivisection. Anyway, the details are rather grim. But the key thing is that neither his nor the prosecutor's version of the events match the version you read.