Hundreds of mourners carried Rayan’s coffin, and laid him to rest two days after he passed away.
Rayan was confirmed dead late Saturday by authorities after an ongoing rescue attempt failed to save him.
The five-year-old boy had been trapped since Tuesday before being retrieved by rescue teams from the well on Saturday, but did not survive his ordeal, state media reported.
Rayan’s parents were transferred to the cemetery in an ambulance, both distressed and in tears as seen on local broadcaster, Chouf TV.
“May God be with my son,” his father Khaled Aourram told Chouf.
Rayan’s rescue efforts gripped much of the country with the hashtag #SaveRayan trending in North Africa and other parts of the world.
The child was stuck in a well that reached more than 100 feet (30 meters) underground in the Chefchaouen province.
Rayan fell into the well Tuesday afternoon and was discovered after he was heard crying, his mother said in an interview with state-owned Al-Aoula TV two days later.
She said he was playing nearby before he disappeared, and that she quickly called authorities after finding out what had happened.
An outpouring of grief
Rayan’s passing generated an outpouring of grief with world leaders offering condolences to his family.
King Mohammed VI of Morocco offered condolences to Rayan’s family in a phone call, according to a statement from the Royal Palace.
“Following the tragic accident that claimed the life of the child Rayan Oram, His Majesty King Mohammed VI, may God protect him, made a phone call to Mr. Khaled Oram, and Mrs. Wassima Khersheesh, the parents of the deceased who passed away, after falling into a well,” the statement said
While French President Emmanuel Macron said that he shared in the pain and grief felt by Rayan’s family and the people of Morocco.
“Tonight, I want to tell the family of little Rayan and the Moroccan people that we share their pain. This evening, I would like to say to the family of the child Rayan and to the Moroccan people that we share their grief,” Macron wrote in a Facebook post Saturday.
Rayan was also mourned by Israeli Prime Minister Naftali Bennett and Dubai ruler Mohammed bin Rashid.