Specialist teams have found the body of the two-year-old boy whose fall down a 100-metre borehole in southern Spain 13 days ago prompted a major rescue operation that has transfixed the country.

Julen Rosseló was having lunch with his family in the countryside on 13 January when he fell down the 25cm-wide hole in Totalán, near Málaga.

A parallel shaft and a small horizontal tunnel were dug to reach the toddler, but the process was slowed by layers of hard rock that had to be cleared with controlled explosions.

In the early hours of Saturday, the local authorities announced that mine rescue experts and a Guardia Civil officer had found the boy’s body.

“At 1.25am this morning, the rescue teams reached the area in the borehole where they believed Julen to be and found the little boy’s body,” the local representative of the central government said in a statement, adding that the judicial process to recover his body had begun.

The prime minister, Pedro Sánchez, said the whole country shared “the infinite sadness” of Julen’s family.

“We’ve been closely following each step towards reaching him,” Sánchez wrote on Twitter. “We will always be grateful for the tireless efforts of those who looked for him in recent days. My love and support to his family and loved ones.”

Andalucía’s regional president, Juanma Moreno, offered his condolences to the family and thanked the “heroes” who had tried to rescue Julen.

“We’d kept hoping right up to the end,” he said.

A spokesman for the government in Andalucía told reporters later on Saturday morning that Julen’s body had been recovered an 4am and a post-mortem examination had begun at 8am.

Alfonso R Gómez de Celis said the toddler appeared to have fallen 71 metres down the borehole and that the rescue had been complicated by a compacted plug of earth above him.

“There are various theories over the cause of that plug, but nothing certain,” he said.

“What we do know is that the position of the body shows that Julen fell 71 metres straight down and was covered by earth. That level of the borehole was full of earth.

Rescuers had previously speculated that the boy’s fall could have brought earth down after him because the borehole had not been lined.

“The thesis is that his own fall caused the earth to fall on top of him,” said Gómez de Celis. “The sides [of the borehole] were very sandy. But it’s a thesis that will need to be investigated.”

It emerged during the rescue operation that the borehole had been sunk without the necessary legal permission.

Gómez de Celis pleaded for anyone who had dug an illegal shaft anywhere in Andalucía to seal it as soon as possible.

Julen’s father, José, said he had rushed to the hole as soon as he heard him cry out on that Sunday afternoon.

“I pushed the stones away and heard my son crying,” he told the local Sur newspaper 10 days ago.

“My son is down there – don’t let anyone try to cast doubt on that. I wish it were impossible for him to be down there, but I heard him. I wish it were me buried down there so that he could be up here with his mother.”

Julen’s parents embrace each other during a vigil earlier in the rescue operation. Photograph: Jon Nazca/Reuters

According to Spanish media reports, Julen’s older brother, Óliver, died of a sudden heart attack at the age of three while walking with his family on a beach in Málaga in 2017. El Confidencial said Óliver had collapsed three weeks earlier but his heart condition had gone undiagnosed.