Islamic State militants had killed or enslaved Ayman's parents in their purge of the Yazidi minority to which he belongs, then sold the four-year-old to Umm and Abu Ahmed, who are Muslims.
For the 18 months he lived with the couple, his relatives assumed he was dead, one of several thousand Yazidis who have been missing since the militants overran their homes in what the United Nations has called genocide.
When Iraqi forces retook east Mosul and the surrounding area last week, they found Ayman and returned him to what is left of his family. While their reunion was full of joy, breaking the bond between Ayman and his adoptive parents brought new sorrow.
Speaking to Reuters journalists brought by Iraqi forces to his home in Rashidiya, north of Mosul, Abu Ahmed swiped through photographs of the boy on his phone: "That’s him riding a bicycle here. That’s him standing in our hall. That’s an exercise machine he played on."
The windows of the couple's one-story home on the eastern bank of the Tigris river have been shattered by a blast that destroyed their neighbour's house, evidence of the fierce fighting that will continue when the army attacks the western side, which is still controlled by Islamic State.
Abu Ahmed emptied the contents of a box onto the bed Ayman used to share with them: toy cars and building blocks, and a children’s book for learning Arabic script.
It was Umm Ahmed’s idea to adopt a child. The couple had no children, and she heard Islamic State was selling orphans in the town of Tel Afar, some 40 km (25 miles) to the west.
“My objective was to win favour (with God),” said Umm Ahmed, only her eyes showing in a gap in her black veil. “To be honest, I wanted to teach him my religion, Islam."
Her husband, a government employee, was against the idea but could not dissuade his wife, who went alone to get the boy from an orphanage run by the militants, paying for him with her earnings as a teacher.
Although the boy cried and did not want to go with her, she coaxed him, saying: "Come, you will be my child. We will live together and I will buy you everything."
Gradually he grew accustomed to his adoptive parents, who taught him Arabic instead of the Kurdish dialect spoken by Yazidis. They told people he was a nephew they had taken in and enrolled him at the local school under the name Ahmed Shareef, but mostly he was kept indoors.
"He was really smart. I taught him to pray and perform ablutions. Do you know how much of the Koran he memorized?" Umm Ahmed said.
They did not want him to forget who he was and encouraged him to speak about life in his village of Hardan. But she said: "I always warned him not to tell anyone (he was Yazidi)."
Islamic State imposed a radical version of Islam in Mosul after establishing the city as its de facto capital: banning cigarettes, televisions and radios, and forcing men to grow beards and women to cover from head to toe.
They branded the Yazidis, whose beliefs combine elements of several ancient Middle Eastern religions, as devil-worshipers.
Sometimes Ayman asked about the rest of his family but Umm and Abu Ahmed did not know what happened to them except for a sister in her mid-teens who was taken as a slave by a militant from Tel Afar. The militant brought the sister to visit several times but her current fate is unknown.
The whereabouts of a half-brother who was sold at the orphanage before Ayman are also not known.
As the U.S.-backed campaign to drive Islamic State out of Mosul gathered pace and the Iraqi army's ninth division reached Rashidiya, things began to unravel for Umm and Abu Ahmed.
On entering the village, a commander received a tip that a Yazidi boy was being held there and dispatched soldiers to retrieve him. The couple had no choice but to give him up.
A video clip of the moment they were parted shows Ayman clinging to Umm Ahmed and crying.
In the clip, provided to Reuters by an aid group embedded with the army, she pleads with the soldiers who came to get the boy. "Leave him with me a bit," she says, then tries to comfort him in spite of her own distress: "You will go and see your mother now... and when you grow up you will come and see me".
Ayman's parents and most other relatives are still missing, but his grandmother and uncle live on the edge of one of several camps to which the Yazidi community has been displaced en masse, about 50 km (30 miles) away from Rashidiya.
Samir Rasho Khalaf (left) thought his nephew had been killed until he saw a post on Facebook on Jan. 28 that a Yazidi child named Ayman Ameen Barakat had been found.
“I was stunned,” said Khalaf. “It’s a miracle: he came back from the dead."
That same night, they were reunited. In a video of the reunion shown to Reuters by the soldiers who handed Ayman over, his grandmother strikes herself on the head repeatedly when she sees the boy, picking him up and wailing in disbelief.
"We all cried," Major Wathiq Amjad Naathar, the army official who oversaw the handover, told Reuters.
That night, Ayman was beside himself and begged to be returned to Umm Ahmed, Khalaf said.
But on a visit by a Reuters reporter and TV crew this week, he appeared happy and calm, if bashful about all the attention.
Asked if he had been happy with his adoptive parents, he said yes, and asked if he was happy to be back with his real family, he said yes too.
Khalaf said he was pleased that Umm and Abu Ahmed kept Ayman safe and healthy, and he was grateful that, unlike so many other Yazidi boys abducted by Islamic State, he was not forced to train with weapons or fight.
But he was angry the couple did not try harder to find his family to say he was alive and well, and has refused to allow them to talk to Ayman, even though they called once.
"We don’t mention them (his adoptive parents) so he will forget them," he said.
Umm Ahmed said he will never forget them, however, just as they will not forget him.
"I expect he will return," she said.
Banner/Thumbnail credit: Reuters