Dr Faisal al-Zidgali, a paediatrician at Ayreshire Central Hospital said Rebecca Cassidy had been "extremely premature" and stood no chance of surviving.
Rebecca was born at the hospital in September last year following a pregnancy of up to 25 weeks, but Dr Zidgali deemed her to be "non-viable" with no prospect of survival.
Her mother, Kirsty, told the court yesterday that she pleaded in vain for him to do something to save the baby because she thought she looked healthy and normal. In her evidence she said the decision whether a prematurely born baby had a right to life should be made by the parents, not doctors.
But Dr Zidgali told the fatal accident inquiry at Kilmarnock Sheriff Court that Rebecca had been an extremely premature baby - 12 inches long, with a head smaller than a tennis ball, bruising across her head and abdomen and fused eyes.
Her heart rate was between 10 and 12 - compared with a normal rate for newborn babies of 120-160 and she felt cold because of poor circulation. She was gasping rather than breathing and the movements she was making were down to involuntary muscle and nerve spasms, the doctor added.
"Rebecca did not have any chance of surviving because of her condition and I did not have any doubt in my mind," he told the inquiry. "We are not just dealing with a premature baby. We are dealing with a very extremely premature baby.
"I think it is futile, heroic and foolish to try to do something for a baby that in my clinical judgement is not viable. You should not do anything to harm the baby."
Dr Zidgali said he had resus-citated premature babies before, even those born in the 23-25 week period (the legal limit for abortion is 24 weeks), but they had all had high heart rates and looked pink and relatively healthy. The longest any survived was for two or three days. In his most recent case, the baby had died after just 10 hours.
Dr Zidgali also denied a number of times that there had been a complete communications breakdown between himself and the parents. After Rebecca's birth he had said to Mrs Cassidy: "I'm very sorry, she's in a very poor condition and there's nothing I can do."
"There was no criticism of my management. She thanked me and wished me the best of luck, and it's not common for us as juniors to be wished the best of luck. I felt really that I did something. That a mum who had been through all this appreciated me and wished me the best of luck."