Behind us lay the Morocco I've known for years: clamouring, raffish and occasionally biblical.
Ahead, through this crack in the Atlas, lay a different world.
This was where the desert began, with snow and foothills at first and then thousands of kilometres of thirst. Here, clouds only appear on 60 days a year, and the landscape looks like embers. Farming survives only in gorges and riverbeds.
The people, too, are different here. Some are Berbers, others are the descendants of slaves who became detached from caravans marching north. Together they're close-knit, tribal and fatalistic.
"It's a good life," said Said. "Unless you get ill, and then you die."
Soon, castles started appearing. Not the drab things we have in Europe but vast patterned promontories, like cliffs with windows. And they're everywhere. One valley, the Dades, once had more than 1000 kasbahs defending its pitiful trickle of water.
I'd like to think these fortresses are obsolete. Not so. During the great Rif War of 1893, most of them burst into life. Some, like Telouet, were still threatening French rule into the 1930s.
Then came the rule of the Glaoui family, who built the biggest and best of the castles. I noticed at the Kasbah Taourirt that a hint of their vanity had survived in fancy-coloured tiles and a Krupp field gun. The Glaouis, explained Said, ruled with spectacular cruelty, drowning their victims in clay and only finally fleeing in the 60s.
So the sieges may have ended but castle life goes on.
At Amerhidil, the most elegant of the kasbahs, I met the owner who shared it with his goats.
"We've lived here 400 years," he told me.
"This is where we hid the guns to shoot the French..."
Meanwhile inside the mighty Ait Benhaddou, people were living much as they had several hundred years earlier, driving camels and charming snakes. Movie-makers love this place and it always pops up in films, from Lawrence of Arabia to Robert Aldrich's Sodom and Gomorrah.
At the heart of this dry, improbable world lies the city of Ouarzazate, "the door of the desert".
It was built for French troops in the 1920s, a last taste of home before dying. But not much "Frenchness" has survived. The entire town was painted desert pink, and there was as much chance of eating squirrel as croque-monsieur.
It was here that I bought some cactus soap and a little carved Malinese door that had somehow crossed the Sahara. But Ouarzazate still has a frontier feel. Here are the last four-star hotels and swimming pools before the sands beyond.
From Ouarzazate, like the soldiers, we set off in all directions.
Once we went to the Oasis de Fint, and had tea with a lady who looked just like her dates and said she was 112 years old.
Another time, Said drove for five hours through gorges and wilderness, right to the edge of the dunes. In Zagora we exchanged our car for camels and rode through a long, green slash of orchards and nurseries known as "the palmary". It was a day that changed colour many times, from red to rust, tobacco, green, red again and then a magnificent purple. At one point the road petered out and a sign appeared: "Timbuktu 52 days."
Ait Benhaddou is loved by movie-makers and has appeared in many films. Photo / Thinkstock
Later we moved to one of the biggest oases, at Skoura. It's an even bigger palmary and a labyrinth of tracks and shady fields. For centuries people have lived here on the brink of desiccation. Moisture is so precious that even grazing is forbidden, and all the animals are fed by hand. But the place has a garden-like air, and life is uncluttered and simple.
Farther west the landscape is even wilder and redder. It begins gently with the Valley of Roses. The town of Kelaat M'gouna produces 4000 tonnes of petals a year; its street of perfumeries sells potions such as "Sexy Man" and "Love Port". But beyond that, the horizon buckles and cracks as it rises towards the Atlas.
Said explained that most people here were nomadic and lived on the plateaus in the summer and in caves in the winter. We met a nomad once, knitting slippers by the side of the road. She was a fierce little girl and wanted £30 for a pair.
All journeys here seem to end in a canyon. The Todra Gorge is like a crack through the mountains, so deep the donkeys inside seldom get sunlight. Even more magnificent is the Dades Gorge, a dizzying fissure of gullies and shadow. The French Army only got a road through in 1933. That year they brought the Middle Ages to an end here, with a brutal campaign involving four air squadrons and 83,000 troops.
The last tribe to give way were the Atta.
"What happened to them?" I asked.
"You just met one," replied Said. "Trying to sell you slippers."
It was an appealing thought. Here in this desert, foreigners may come and go, begging or stealing its beauty. But when the dust has settled its ancient people are still firmly in control.
CHECKLIST
Getting there: From Marrakesh's airport it's a five-hour drive to Ouarzazate. All big car-hire companies operate out of the airport. Alternatively, Royal Air Maroc has flights to Ouarzazate via Casablanca.
When to go: This is a great winter trip as the weather is cool but bright. Ouarzazate can be extremely hot in July and August.
Souvenir hunt: Excellent dates are on sale everywhere. Other appealing purchases are camel-skin slippers ($14), Malinese carved doors ($17), and any amount of fossils and antiques, often fake.
What to avoid:
• Do not break the speed limit. The Moroccan police are enthusiastic about their on-the-spot fines.
• Never assume that blackened artefacts are genuinely "antique". They're usually fake.
• Don't worry about the car "guardians". Often they're licensed and only charge a couple of bucks.
• Be aware that the mountains are very cold at night. Bring a fleece or a thick jacket.
• On the road to Zagora, be wary of drivers who've "broken down". It's often a ruse for selling carpets.