A toddler born with three legs – because body parts of a twin had grown inside her – was returning home to Bangladesh Friday after complex and rare surgery in Australia enabled her to walk and run, her doctor said.

Three-year-old Choity Khatun was given little prospect of survival until she was brought to Melbourne last year by Australian charity Children First Foundation.

A team of surgeons spent several months mapping out a procedure to reconstruct her anatomy.

“A twin had grown out of her pelvis but the twin was only part of a twin… The problem is there’s no rulebook for this because she’s a very unique individual so you have to try and work out what was where,” Chris Kimber, the paediatric surgery head at Monash Children’s Hospital, told AFP.

“When Choity arrived in Australia, she was very malnourished, she couldn’t walk properly at all,” said Kimber.

Working in consultation with experts from Europe and the United States, the surgeons planned a procedure that involved removing the remains of the third leg – part of which was earlier cut off in Bangladesh – as well as taking out, disconnecting and reconnecting other organs.

Choity’s condition meant that body parts from a twin developed in her perineum – the area between the anus and the vulva.

Surgeons spent countless hours examining her under anaesthetic and found she had two rectums, anuses, vaginas and uteruses. She was also incontinent.

The surgery, which Kimber said was “extremely rare“, was finally carried out in November and involved eight doctors who specialise in genital and pelvic reconstructions working on the girl for eight hours.