A five-year-old Moroccan boy who had been trapped in a well for four days died despite a painstaking effort to save him.
A royal statement announced his death shortly after he was removed from the well.
A bid to release a boy named Rayan seized control of the country, with hundreds of people gathering in wells and thousands more following online.
The boy plunged 32 meters (104 feet) from the narrow opening of the well. Rescue was hindered by fear of landslides.
The rescuers finally took the boy out of the well on Saturday night.
Nothing was said about his condition at the time, and at first he was clearly rescued by the cheers of the crowd.
On social media, people using the hashtag #SaveRayan have expressed their joy as they are prevalent across the country and elsewhere.
But this turned into a broken heart a few minutes later when a statement was made announcing that Rayan had died.
Later, Twitter users began to use the same hashtags to pay homage and express sadness.
“After the tragic accident that killed the child Rayan Olam, His Majesty Mohamed VI called the parents of the boy who died after falling from the well,” a statement from the Royal Palace said.
The king added that he expressed his deep condolences and heartfelt compassion.
Rayan’s father was repairing the well at the time of the accident. He said his son had fallen “the moment he took his eyes off him.”
Rescue efforts began Tuesday night in the small northern town of Tamorot, about 100 km (62 miles) from the city of Chefchaouen, led by the Moroccan Civil Protection Agency.
Images from the camera dropped into the well on Thursday showed that the boy was alive and conscious, but since then there has been no up-to-date information on his condition.
The rescuer tried to give the boy oxygen, food and water, but it was unclear if he could use them.
Due to the mixture of rocky and sandy soil, rescuers thought it too dangerous to open the thin shaft of the well.
Instead, I used a bulldozer to cut a huge ditch next to the well.
The rescuer then began digging horizontally to reach the boy. Some people worked 24 hours a day, using powerful floodlights at night.
Hundreds of people gathered to watch surgery, sing religious songs, and pray and sing “Allahu Akbar”. Some even camp there.
This incident is reminiscent of a similar tragedy in Spain in 2019. A 2-year-old boy who fell into a well near the city of Malaga died..