It is too easy to cling to the coast in Tunisia - Tunis, Hammamet, Sousse, Monastir, Sfax - especially if you wend your way by train. Maria and I found ourselves at the end of line, Gabes, the last mainland seaside town before the Libyan border. It is also an oasis, but at the time this did not interest us as much as the fact that it was the ideal springboard for a visit to the troglodyte settlements at nearby Matmata.

Weary of the sea, we chose a hotel in the middle of shops and small restaurants on the Avenue Habib Bourguiba. It was simple and a trifle ramshackle, a step back into Tunisia's French colonial era. The screens on the windows were no match for the Berber mosquitoes, so, exasperated, we rose earlier than planned to visit the cave dwellings 30 miles to the south.

The dawn flamed as our bus roared off along the lightly undulating Plain of Arad, the only sign of life a distant shepherd and his straggling flock, and a curl of smoke from some lonely abode. By the time we ascended into the bald hills, however, the sky was a sharp blue and the heat quickening. As the road snaked suddenly upwards we felt distinctly queasy. Not a moment too soon the driver yelled 'Matmata'. Before us was nothing but a mosque and the odd palm and olive tree in a lunar landscape freckled by scrub.

A buzzard wheeled overhead as we made along a faint path. After just a few paces we came upon a man-made crater, one of about 700. Each pit-courtyard was about 10 yards in diameter and eight yards deep. Dug out of the clay and marl soil, they are cooler in summer and warmer in winter than the dwellings above ground - a perfect solution to the area's climatic extremes.

Peering down at one of these patios, we saw washing flapping; in another a child chased a chicken; and in a third a woman hurried off into one of the underground rooms. We felt like enfants terribles but the pastime was addictive. At a sixth, a man sitting on a low stool reading a newspaper glanced up and hailed us to come and see his home.

We descended a steep, open-air passage, off which was a subterranean stable with a tethered donkey. Our host introduced himself as Azouz, and his wife, resplendent in a sapphire and saffron skirt, joined us, a wide-eyed moppet clasped in her arms. The couple admired Maria's mass of coppery hair; we admired their baby; and then they invited us into one of the chambers radiating off the ochre courtyard.

The vaulted interior was whitewashed and included a filigree carved from the earth that fronted recesses and holes in the wall for storage. Household pots and pans were arranged on the wall. Corn was being ground on a millstone. Other chambers leading from the main court were closed off with palm-wood doors, and spikes in the wall formed a staircase to one or two upper rooms.

The scene was too intimate for photographs, but Azouz asked if we had a camera. He wanted a picture of his family. I obliged and posted it to him later. His address was simply 'Matmata'.

On the trip back to Gabes, we thought, what now? Back up the coast, with maybe a jaunt inland to Kairouan, Tunisia's holy city? Maria's guidebook spilt forth the fact that the oasis of Gabes had once terminated the Roman road from Biskra in Algeria. We suddenly had an itinerary: visiting the oasis towns that dotted this antique route. Our time was limited, but the thought of a dash into Algeria and racing back to Tunis via Constantine put us in a jolly mood.

Back at Gabes, we made first for the medieval Jara market, set within an arcaded square. There we passed basket weavers and salt merchants, and watched the haggling over salted fish, dried octopus, mounds of dried red peppers, almonds and pistachios. The air was heady with the scent from white spice sacks of cumin, coriander, cinnamon, fennel and aniseed. Further on, bundles of brilliantly coloured clothes were piled on mats on the ground. For lunch we ate brik, a semi-circular light pastry filled with egg, and sometimes meat or spinach. It is not something to be delicate about, but should be grasped in both hands and bitten into with relish.

Later we hired a hippomobile, a horse-drawn carriage with green wheels and florid canopy, to tour the oasis. They say dogs resemble their owners - so it seemed with the horse, who was gentle-faced and scrawny-bodied, and wore a wide-brimmed straw hat.

We wobbled along shady roads bordering irrigation canals reflecting date palms, eucalyptus, grape vines, fig and pomegranate in their waters. There was silence among the trees. Over one of the frond fences a group of women in bright dresses and scarves were standing, resting from their work harvesting henna in the fields, or so we imagined until our driver turned and waved in their direction with the word 'epouvantails' - scarecrows.

Further on, we saw a chaffinch and heard the cooing of turtle doves. Our driver drew up at the blue and white Cascade cafe, but the nearby marvel after which it was named had dried up. Children and a barking dog ran behind us as we passed on through the village of Al Maita. We stopped once again, and were led down a path to a Roman dam, but this idyll was tarnished by souvenir booths, pylons and a plangent pumphouse.

I paid our hotel bill that night, but had to rouse a pyjama-clad manager to unlock the doors to let us out. In the street, the air stirred with the muezzin's calls to prayer. We purchased our bus ticket from a tiny bureau, and ate a brioche and drank a glass of lukewarm qawha halib (milky coffee) before the bus set off.

Most of the scenery en route was obscured by blinds drawn to keep the sun at bay. By mid-morning we felt nostalgic for the bottles of Fanta sold from ice- packed zinc buckets on the trains. I woke from a heat-induced doze and lifted the blind to catch a glimpse of the chott, or salt lake, on which mirages shimmer, where merchant caravans have vanished, and careless tourists finished up as nice pieces of crackling.

We stepped off the bus into a midday temperature of 49 C. Understandably, Tozeur was like a ghost town. We shuffled down another Avenue Habib Bourguiba, enveloped in heat and glare, then staggered into a hotel and spent the afternoon recovering.

As the stars filled the desert night, we took a turn around the gardens. A turbanned ancient was watering the green carpet tiles, curling at the edges, that comprised the lawn. We laid bets on whether the bougainvillaea was silk. I lost. The palm trees of the oasis were also real.

Early the next morning the air seemed exhilarating at 30 C. We wandered into Oulid Hadif, the 14th-century medina. Unfired, buff-coloured bricks wove geometric designs on the buildings' facades. Vaulted passageways over lanes of sand cast angular patches of shade.

Within the Archaeological and Traditional Museum in the former shrine of Sidi Ben Issa, a Sufi saint, stone columns attested the antiquity of Tozeur, once the Roman post of Thururos. The museum's other delights included circumcision costumes, muskets, bedouin jewellery, Arabic tomes, a giant pitcher for dates, and the headless torso of Juba II, Cleopatra's son-in-law.

In modern Tozeur we went souvenir hunting. We liked the local rugs which reproduced the brick designs of the town, but the heat had given us an aversion to anything woollen. Maria wanted a present for her mother, but the pickled scorpions and stuffed jackal we saw did not seem suitable.

In Gabes, we had been told that there was a bus service from Tozeur to the oasis El Oued in Algeria. In a domed marabout that housed the information office they looked amazed as I imparted this fact. However, there was a train back to the coastal town of Sfax.

Disappointed, we made for the shade of a corrugated-iron awning, and beneath it sat at a formica-topped table on the pavement outside a patisserie fronted with blue-and-white tiles. We ordered mineral water and two samsas, triangular pastries filled with ground nuts and rose water, fried and dipped in a honey syrup.

Sighing, we stared across sleepy Avenue Bourguiba, strung with little red-and-white Tunisian flags and coloured light bulbs. The few cars that passed were outnumbered by mule-drawn carts and men on bicycles. Unexpectedly, one stopped before us. The owner announced he could arrange a trip to the border, if we were interested, to leave that afternoon. Would there be transport from the border, I asked? Mais oui] From the border there were buses and taxis. This was pas de probleme. Our spirits soared, and we quickly agreed a price.

The sun had bleached the sky by the time we rumbled off in the cabin of Hassan's pick-up. We had a fleeting view of Nefta and its terraced slopes, the white cupolas of marabout tombs and dense emerald palm groves. A sign indicated that the border at Hazoua was 20 miles distant.

After 20 minutes we arrived at a small dust-blown building. A barrier spanned the bitumen road. Inside the customs post two guards and a civilian sat playing cards. They finished their hand, then one of them stamped our passports. Where was the Algerian border? Six, maybe seven kilometres away, he told us, then sat down, shuffled and dealt the pack of cards.

Outside, Hassan was understandably impatient for his money and to return to Tozeur. However, I politely reminded him the deal was the Algerian border. Grinding his teeth, he drove around the barrier and off we went. Three minutes across no man's land, we sighted the red crescent and star and green and white of the Algerian flag.

I began to unload our rucksacks and had my wallet in my hand when Maria returned with news that there were no buses on to El Oued. She had also learnt that we each had to change 1,000 dinars, about pounds 80, during our stay. We estimated we could not spend this amount in the four nights we had planned in Algeria. We decided to return to Tozeur, and I reloaded our luggage in the pick-up. Hassan was furious.

We sped back in the falling night. At Tunisian customs the card game continued. A trump was played. The douanier refused to stamp our passports. His logic was simple: we could not leave Tunisia, and return from nowhere. An exit stamp from the Algerian border was necessary. The card game restarted.

We were nonplussed, but it was a fraught Hassan who started the argument with them. An hour of heated Arabic passed before our financial offering encouraged an entry stamp. The civilian at the card table then decided to visit his family in Tozeur, and my wife and I were relegated to the back of the pick-up with the baggage.

Back in Tozeur we paid Hassan his fee and some more besides, and stumbled into the French-

African atmosphere of the Hotel Splendid. The receptionist stared at us and we soon found out why: sand had stuck to our faces, leaving us looking like a pair of demon jinn from the Thousand and One Nights.

The next day we were back on the Mediterranean coast. The sea, by the way, looked wonderful.

The author did eventually travel to Algeria. His novel, 'A Country of Vanished Dreams', was published by Picador ( pounds 14.99) in March.


Flights: Panorama (0273 206531) offers charter flights on Fridays, Sundays and Mondays from pounds 199 to pounds 219 return. Flights go from Gatwick, Manchester and Dublin to Monastir, Sfax and Djerba. The company also does package tours to a range of Tunisian destinations.

Trailfinders (071-937 5400) does scheduled flights with KLM from Heathrow via Amsterdam to Tunis for pounds 245 return.

Health: Vaccinations are not compulsory, but those who want to be safe are advised to have typhoid, hepatitis A, cholera, polio and tetanus jabs.

Money: The Tunisian dinar is a soft currency (it cannot be taken into or out of the country). One dinar is worth about 65p at current exchange rates.

Tunisian National Tourist Office, 77a Wigmore Street, London W1H 9LJ (071 224 5561). Closed on Saturdays.

(Photograph and map omitted)