The five-year-old boy spent four days trapped in the deep well while the rescue team worked tirelessly to save his life.
The Moroccan royal palace informed that the boy died before the rescue workers could reach him. Moroccan King Mohammed VI confirmed the tragic news.
The boy named Rayan fell 32 meters (105 ft) down a well where he got trapped. A tunnel was dug specifically for the rescue.
Footage recorded at the scene shows how the boy was carried out of the tunnel by emergency workers. They spent an hour inside before they emerged with Rayan held on a stretcher.
The boy's parents were led to an ambulance while waiting to see their son.
On Tuesday, February 1, five-year-old Rayan was found in the well. The accident happened while his father was repairing the well located in the Chefchaouen province. Rayan's crying after the fall alerted his family members.
The boy's mother quickly contacted the authorities, and rescue workers were sent to the location. They lowered a camera down the well and found that Rayan had fallen 32 meters.
To be able to reach him, the rescue team had to dig a 100 meters deep trench alongside the well to be able to create an access tunnel. It took three days just to make the trench.
The threat of landslides was imminent, and getting supplies to Rayan was difficult. The workers struggled to get oxygen and water down to the boy because of the narrow diameter of the well.
Hundreds of villagers joined the boy's parents by the excavation site. They offered their support for the family, and so did thousands of people on social media. The rescue team's efforts and the boy's fate received worldwide attention.
Rayan's mother, Wassima Kharchich, had previously shared her fears with the local media.
"I pray and beg God that he comes out of that well alive and safe. Please God, ease my pain and his, in that hole of dust."
After the tragic news about his death, thousands of people showed their sorrow and support. King Mohammed VI sent his condolences to Rayan's parents, and he also praised the rescue team and the community for supporting Rayan's family.