A Court of Protection judge has ruled doctors can carry out a caesarean section on a heavily pregnant woman with mental health issues.
Hampshire Hospitals NHS Foundation Trust (HHFT) told the court there were complications and the baby was at risk if she did not have the procedure.
But the woman said she did not want her baby delivered by caesarean section.
On Friday, Mr Justice Francis gave doctors the go-ahead and said doctors could restrain her if necessary.
He said evidence showed the woman did not have the mental capacity to make decisions about medical treatment and concluded a section delivery would be in her best interests.
The HHFT trust, which had responsibility for the woman's care, asked for a ruling.
Lawyers representing hospital bosses said a decision was needed urgently because mother and baby were at risk.
The judge analysed evidence at a public hearing in the Court of Protection in London, where issues relating to people who lack the mental capacity to make decisions are considered.
Mr Justice Francis also made a ruling the woman, who is in her 30s, could not be identified.