RIYADH, Saudi Arabia — The doctor told the parents to say goodbye. With wet eyes, they held out their palms in prayer and bent over the hospital bed to kiss their daughters’ tiny foreheads.

The girls had spent the year since their birth facing each other like mirror images they could not escape. Identical twins joined at the belly, each had two arms and two legs, individual hearts and digestive tracts, but they shared a liver. Blood pumping through one also flowed through the other.

They could stand with their mother’s help, sometimes posing cheek-to-cheek, other times draping their arms around each other’s neck as if slow dancing. Now, shortly after their first birthday, they had traveled from their poor town in Pakistan to oil-rich Saudi Arabia for a rare and risky separation surgery that would radically change their lives.

“I still have doubts, and I am scared,” said their father, Nisar Ghani, 45, as the doctors wheeled the girls, Fatima and Mishal, toward the operating room. “In the end, it is all up to God.”