A three-year-old boy whose father tried to prevent him receiving life-saving hospital treatment will have a bone marrow transplant on Thursday following an emergency ruling by a High Court judge.

The boy, known only as AA, was born in an Arab country and has spent the last two years in a leading English children's hospital. AA's immune system was "effectively deleted" last week in preparation for a transplant, leaving him at fatal risk of infection.

His father had originally consented to the operation, but at the last minute withdrew his permission, insisting that his son instead be flown home to be with him. Such a move would "almost certainly" kill the toddler, who is being kept in a special sterile room, lawyers for the hospital said.

Download the new Independent Premium app Sharing the full story, not just the headlines

The boy's bone marrow donor is his mother, who is estranged from his father. She wanted the procedure to go ahead and was unable to attend court because she was giving blood in preparation for the operation.

The case was heard by Mr Justice Mostyn in the Family Court at the Royal Courts of Justice in London. Justice Mostyn's decision to order a caesarean section for a woman with severe bipolar in the Court of Protection last year has been causing controversy this week after details of it emerged in the press.

Justice Mostyn said there were no facilities for bone marrow transplants in the Arabic country AA is from and that, "even if there were, he cannot be flown there as it is highly likely he would contract an infection and die". He concluded:"This child is my ward and I cannot contemplate that."

The transplant is necessary to alleviate a number of serious conditions which were not specified in court. A lawyer acting for the hospital said that having had his immune system effectively removed, AA was "in a perilous state and highly vulnerable."

He added: "He is liable to contract an infection of which he will almost certainly die. The only way to get him out of this situation is to go ahead with the transplant."

Previously AA's father had been so enthusiastic about a transplant that he flew several of his children to the UK to be tested as donors. The toddler's sister turned out to be an almost perfect match, but their father decided he no longer wanted her to make a donation.

The hospital's lawyer said: "The father thinks his son doesn't need this treatment and should be returned to [the Arab country]... He has provided no medical reason and no convincing ethical reason why this treatment should not take place."

Daily coronavirus briefing No hype, just the advice and analysis you need Enter your email address Continue Continue Please enter an email address Email address is invalid Fill out this field Email address is invalid Email already exists. Log in to update your newsletter preferences Register with your social account or click here to log in I would like to receive morning headlines Monday - Friday plus breaking news alerts by email Update newsletter preferences

Lawyers spoke to AA's father and made him aware of the hearing. He told the hospital's solicitor that he had "never agreed" to the transplant and said lawyers from his country's embassy might attend the hearing, but none appeared.

The mother's bone marrow is a good match to her son's but is not as close as his sister's. Doctors now believe it is his best hope for survival.

The children's hospital applied to the Family Court to intervene on Monday, when the judge ruled that the child would now become the ward of the court. The second hearing today was to decide his treatment.

Justice Mostyn said: "The evidence seems to me that the father had, in effect, consented by sending over members of his family to see if they could be matching donors."

The judge said that the court could intervene in the case because although AA originated from another country, he had been living in an English hospital since November 2011. He added: "In my judgement he is habitually resident in this country and in these circumstances the court has jurisdiction over him."

Summarising clicians' evidence, Justice Mostyn said: "The transplant from his mother will take place tomorrow. If it does not take place it is almost certain that AA will soon die."