A high court judge has given doctors permission to perform an urgent caesarean section on a mentally ill woman who has diabetes. Mr Justice Hayden gave specialists working for the Royal Free London NHS Trust the go-ahead after a five-hour hearing in the court of protection in London.

The judge said a decision "compelling" a caesarean was "draconian", but he had heard evidence that the woman's life might be in danger. He said he had concluded that the woman, who is 32 and 32 weeks pregnant, lacked the mental capacity to make decisions about whether or not to have her baby delivered by C-section.

Trust officials had applied for permission, saying doctors thought an urgent caesarean necessary so that the woman's "unstable mental state" could properly be treated. One specialist told the judge that the priority was "keeping this woman alive". He heard that she was thought to be suffering from paranoid schizophrenia and had attempted suicide.

The judge said neither the woman nor the hospital could be identified, but said the health authority could and should be named. He said the scrutiny of doctors' conduct could only "serve to reassure public confidence".

The court of protection is part of the high court and analyses issues relating to sick and vulnerable people.

"The decision to compel a caesarean section on an incapacitous woman who is mentally and physically ill is an extremely draconian one," said Mr Justice Hayden. "Doctors do not embark upon this lightly. It occurs extremely rarely. It is one that the lawyers also take very seriously indeed.

"I am perfectly satisfied that at the moment [this woman] is not able to make any reasoned evaluation of the advantages and disadvantages of a caesarean section."

He said he had also concluded that the woman – who had stopped eating – lacked the capacity to regulate her own diabetic medicine and monitor her own intake of food and water. But doctors were not given permission to use force or restrain the woman. Medics thought that the woman could be persuaded to agree to sedation and did not think that force or restraint would be needed, said the judge.

One doctor told the court that the woman's physical and mental problems should lessen – and be easier to treat – once the baby was born. And the doctor said it was feared that the woman might have to have to be restrained so that nutrients could be fed through a drip if the baby was not delivered.

A specialist said the baby should not be at risk if delivered via caesarean section at 32 weeks.