Toddler twin girls who were conjoined at the head were successfully separated following 50 hours of surgery at a London hospital.

>> Read more trending news

Safa and Marwa Ullah were born in Charsadda, Pakistan, in January 2017. The sisters are craniopagus twins, meaning they were joined at the head.

About 5 percent of conjoined twins are craniopagus cases, CNN reported. Most craniopagus twins are stillborn or die during labor, while a third more do not survive the first 24 hours.

A wealthy benefactor paid for the girls to undergo separation surgery at Great Ormond Street Hospital in London. They were separated over a series of three surgeries, the first taking place in October 2018, and the last in February.

The doctors used virtual reality to create an exact replica of the girls' anatomies in order to visualize their skulls and the positioning of their brains and blood vessels. They also made 3D models of the girls' skin, skulls and brains.

"These are really unique cases, and it's not something that we get taught in medical school," surgeon Juling Ong told The BBC. "With this software, we can make a realistic computer model to look at the extraordinary anatomy of these children and plan our surgeries beforehand."

The first two surgeries focused on separating the girls' brains and blood vessels. In the final surgery, doctors constructed new skulls for each girl using their own bone.

While the surgeries were successful, they weren't without their problems. During one surgery, Marwa's heart rate fell. Fearing she would die, doctors gave Marwa a key vein she shared with her sister. However, this resulted in Safa suffering a stroke.

The girls were discharged from the hospital July 1 and are doing well despite the challenges that lay ahead of them. Their father died before they were born, CNN reported, but their uncle and grandfather lend help.

The girls' mother, Zainab Bibi, is currently residing with them in London while they undergo physiotherapy.

"We are indebted to the hospital and to the staff, and we would like to thank them for everything they have done," Bibi said. "We are extremely excited about the future."