SAHARA DESERT, Morocco — The most popular runner in one of the world’s most difficult races is, strictly speaking, not an official entrant. Or even human.

A dog nicknamed Cactus suddenly appeared on Monday during the Marathon des Sables, a 140.7-mile stage race made harder by the heat, wind, sand dunes, rocks, stony plateaus and dry valleys of the Sahara in southern Morocco, the rough equivalent of running 23.5 miles a day for six days.

Cactus skipped Sunday’s first stage, but ran nearly 15 miles on Monday, then completed the full 23 miles of Tuesday’s stage and the entire 47.4-mile stage on Wednesday, showing great resilience and a skittering ability to navigate the dunes.

While the nearly 800 human runners were given 31 hours to complete Wednesday’s ultralong stage, Cactus needed only about 11 hours 15 minutes, some of it in a sandstorm, which would have put him 76th in the stage results. Then he ran a couple of extra miles to cool down.