DUSK was falling on Tangier and small cliques of nattily dressed expats were sipping mint tea and socializing on the top floor of the Hôtel Nord-Pinus, a sumptuous riad-style guesthouse in the Casbah. A gentle sea breeze wafted through the arched doorways and filled the stylish lounge, decorated with embroidered Moroccan pillows and modern photography, with an air of exclusivity. Down the street, a different scent drifted from the fabled Café Hafa, once the haunt of Beat poets and musicians like the Rolling Stones. Two dozen young men were sitting on battered folding chairs, several discreetly smoking kif — tobacco blended with hashish. This Moroccan port has always been a city of extremes — a surreal crossroads where Northern Africa meets Europe, the Mediterranean meets the Atlantic Ocean, and hedonism and history seem to intermix. But while the gritty authenticity of Tangier is still there, a new generation of artists and expats is giving this fabulously shabby port a new shine. As recently as the last decade, Tangier was still considered a down-on-its-luck town riddled with drugs and hustlers. But while sleazy dives, decayed buildings and dark alleys can still be found, a stylish new Tangier has emerged, fueled by royal investments and a thriving arts community. There are now renovated architecture gems like the '40s Cinémathèque de Tanger, quirky boutiques loaded with one-of-a-kind objects, and cafes that draw a sophisticated but idiosyncratic crowd. That crowd today includes the supermodel Jacquetta Wheeler, Bruno Frisoni, the designer for Roger Vivier, and the French writer Bernard-Henri Lévy, who recently bought a starkly modern house next door to the Café Hafa. Much of Tangier's renaissance can be traced back to Morocco's young king, the 45-year-old Mohammed VI. Unlike his father — the late King Hassan II who ruled Morocco for 38 years and was said to have despised Tangier — the new king is an enthusiastic champion. Instead of an urban wasteland, he sees Tangier as a cultural and commercial gateway between Africa and Europe. The young king installed Mohamed Hassad, a forward-thinking politician known for turning around Marrakesh, as the governor of the Tangier region. The king was also the driving force behind Tanger Med, a giant new cargo port whose administrative center was designed by the French architect Jean Nouvel. Also in the works is a high-speed train network that would cut the travel time between Tangier and Marrakesh to less than three hours. Despite the changes, the surreal jumble of Escheresque alleyways, crooked white facades and shady courtyards that make up Tangier's historic heart hasn't changed since Bowles wrote “Without Stopping,” his 1972 autobiography that recounts his itinerant love affair with North Africa. In it, Bowles described Tangier as “rich in prototypal dream scenes: covered streets like corridors with doors opening into rooms on each side, hidden terraces high above the sea, streets consisting only of steps, dark impasses, small squares built on sloping terrain so that they looked like ballet sets designed in false perspective, with alleys leading off in several directions; as well as the classical dream equipment of tunnels, ramparts, ruins, dungeons and cliffs.” And the slightly sinister and exotic underbelly that inspired Burroughs's “Naked Lunch” is still found at places like Café Hafa and Café Central, a faded coffeehouse in the seedy but always buzzing Petit Socco square, where everyone seems to have something to hustle among the fin-de-siècle facades. But there is also a glamorous new side to Tangier, where socialites air kiss by the palm-lined swimming pool at La Villa Josephine, a lavish hillside retreat. Or where coiffed ladies nibble on prawn cocktails at the restaurant of the Le Mirage resort, built on a cliff overlooking an expanse of caramel-colored sand. On a breezy Friday afternoon last summer, Le Mirage was filled with wealthy Moroccans, bronzed European families and ladies dressed in Palm Beach whites and peacock-colored caftans. They sat on a portico-shaded terrace, exchanging gossip about other expats and recent trips to Marbella, Spain. Burroughs wouldn't have lasted two minutes in this crowd. “There's a wonderful term in ornithology that is perfect for the kind of people that end up here,” said Elena Prentice, an American painter and philanthropist who lives in Tangier. “They are called accidentals, birds that end up in an area they don't really belong. Everyone in Tangier is some form of accidental.” GETTING THERE Royal Air Maroc, Delta and Iberia Airlines fly from New York City to Tangier, but require a stopover, usually in Casablanca, Madrid or Barcelona. Round-trip fares for travel next month start at around $950, according to a recent Web search. Tangier's historic center is easily explored on foot. WHERE TO STAY The two-year old Hôtel Nord-Pinus Tanger (11 Rue du Riad Sultan; 212-61-228-140; www.nord-pinus-tanger.com) is arguably the most luxurious riad in the Casbah. The interiors of its one double room and four suites are richly detailed with Fez tiles, painted leather doors and four-poster brass beds. Rates start at 280 euros (about $360 at $1.29 to the euro), and include airport transfer, and either breakfast and dinner or breakfast and lunch. Next door is La Tangerina (19 Rue du Riad Sultan, Casbah; 212-39-947-731; www.latangerina.com), a 10-room riad hotel with a small hammam run by a friendly and English-speaking couple. It might not have the glamour of the Nord-Pinus, but the rooms start at 500 dirhams (around $60 at 8.8 dirhams to the dollar). The Alhambra meets the Hilton at the faded but still prestigious Hotel El Minzah (Rue de la Liberté 85; 212-39-333-444; www.elminzah.com). It has all the expected perks: spa, outdoor pool and garden. Rooms from 1,300 dirhams. WHERE TO EAT Helmed by the top chef Moha Fedal, the restaurant at the Riad Tanja hotel (Rue de Portugal; 212-39-333-538; www.riadtanja.com ) serves modern Moroccan cuisine including a delectable pastilla of monkfish. A five-course dinner is about 300 dirhams. Darna Women's Community Center (Rue Jules Cot, Grand Socco, 212-39-947-065; www.darnamaroc.org) has a simple cafe with an courtyard that is both affordable and fashionable. The menu, which usually includes a soup, salad and a Moroccan dish like chicken tagine, is a bargain at 35 dirhams. The rustic but friendly Restaurant Populaire Saveur (Escalier Waller 2; 212-39-336-326) is a happy and reliable place for generous plates of Moroccan seafood, including a tasty fish soup and seafood tagines. About 150 dirhams a person. WHERE TO SHOP Laure Welfling (3 Place de la Casbah; 212-39-932-083), a boho-chic shop overlooking the Place de la Casbah, is owned by an interior designer who lives in Paris and Tangier. The shop carries a mix of glamorous caftans, handbags and ceramic plates painted by Ms. Welfling's husband. For Moroccan jewelry, handwoven Berber rugs and African textiles, look no further than Boutique Majid (66 rue les Almouhades, 212-39-938-892; www.boutiquemajid.com), a three-story maze of treasure