Rare conjoined twins have been separated at a world-leading children’s hospital in London, surgeons have announced.

Two-year-old sisters Safa and Marwa Ullah, from Charsadda in Pakistan, underwent three major operations to separate their heads at Great Ormond Street hospital (GOSH).

The first operation took place in October 2018, when the girls were 19 months old. The last operation, during which they were finally separated, was carried out on 11 February.

The girls, who were born by caesarean section, were craniopagus twins, with their skulls and blood vessels fused together. GOSH has previously successfully separated craniopagus twins in 2006 and 2011.

In order to ensure the operations went smoothly, experts used virtual reality to create an exact replica of the girls’ anatomies. This enabled surgeons to visualise the complex structure of their skulls as well as the positioning of their brains and blood vessels.

Safa and Marwa before the surgery to separate their heads. Photograph: Great Ormond Street hospital/PA

A team also used 3D printing to create plastic models of the structures that could be used for practice. Cutting guides were created so that surgeons could work more precisely.

During the surgery, doctors first worked to separate the girls’ blood vessels and then inserted a piece of plastic into their heads to keep the brains and blood vessels apart. Scans had shown that the girls have two distinct brains but these are misshapen, which the plastic and an accompanying pulley system helped to correct.

During further surgery, the girls started to bleed after clots formed in Safa’s neck veins and she began to shunt blood to her twin. Doctors were concerned they might lose Marwa during the operation after her heart rate fell. As a result of her complications, they gave her a key vein that the twins shared. But this had an impact on Safa, who had a stroke less than 12 hours later due to the loss of the vein.

The final major operation involved medics building new skulls using the girls’ own bone. They also used tissue expanders to ensure each girl’s skin would stretch over the top of her head.

The surgery, which was paid for by a private donor, has been followed by several smaller procedures to enable the girls to live independent lives. The operations added up to more than 50 hours of surgery time and involved 100 members of GOSH staff.

The girls’ mother, Zainab Bibi, 34, said: “We are indebted to the hospital and to the staff and we would like to thank them for everything they have done. We are extremely excited about the future.”

The girls, whose father died of a heart attack while their mother was pregnant with them, were discharged from GOSH on 1 July and moved to a London address with their mother, their grandfather Mohammad Sadat and an uncle, Mohammad Idrees. They are undergoing daily physiotherapy as part of their rehabilitation.

The girls were born by caesarean section. Photograph: Great Ormond Street hospital/PA

Neurosurgeon Noor Ul Owase Jeelani and craniofacial surgeon Prof David Dunaway led the team that operated on the girls. They said in a statement: “We are delighted we have been able to help Safa and Marwa and their family. It has been a long and complex journey for them … Their faith and determination have been so important in getting them through the challenges they have faced. We are incredibly proud of them.

“We are also incredibly proud of the GOSH team responsible for their treatment and care over the past 10 months. GOSH really is one of the few hospitals in the world with the infrastructure and expertise to carry out a separation like this successfully.”

Conjoined twins are very rare – affecting only about one in every 2.5m births.