CONSIDERING the help provided to big foreign manufacturers in Morocco over the past few years, it would have taken a serious effort by them to fail. Renault, a French carmaker, for example, is thriving: of 2.8m cars it made globally last year, one in ten trundled out from its two shiny assembly plants in Tangier and Casablanca. It hopes eventually to make 400,000 cars a year. The government provided land, excellent roads and power supply, tax advantages and a dedicated railway line to get the vehicles to an enormous port in Tangier. Official efforts to snip red tape and make it easier for firms to operate, and a penchant for signing free-trade deals, help to explain why foreign-direct investment is soaring, even as it shrivels for its neighbours.

One of Morocco’s main draws is a supply of cheap labour. But it has also spent heavily on infrastructure, and not only for Renault. Its road network, railways, airports and ports are modern and well-maintained. It is handily close to the European home of many of the firms that have invested. But most of all, unlike Algeria, Tunisia and Egypt, which to varying degrees can match these other advantages, it offers political stability. The king, Mohammed VI, has championed a plan to industrialise quickly and create jobs for young Moroccans. “We are trying to do in ten years what Britain or France took 80 years to do,” says a Moroccan businessman working with Safran, a French industrial group.

The country’s welcome mat has brought jobs. Four years ago Renault invested €1.6 billion ($2.1 billion) in its main car plant, Africa’s largest, and it now employs nearly 10,000 staff locally. The firm is one of Morocco’s biggest companies. It produces vehicles such as the Lodgy, an entry-level people-carrier sold in Europe. Rapid growth proved possible partly because the king ordained it (his decrees get otherwise languorous civil servants to jump)—for example, in providing generous subsidies for training. Other firms are being lured by Morocco’s largesse. PSA Peugeot Citroën will open an assembly plant in Kenitra, on the Atlantic coast, in 2019, and plans to make 200,000 cars a year.

Domestic sales account for a modest part of production. Marc Nassif, general manager for Renault in Morocco, says locals bought 125,000 cars last year, about two-fifths of them from his firm. More important are car exports that earned Morocco a hefty €4.8 billion last year, making them the country’s biggest single export. That is not a bad record for a country that, until recently, relied mostly on textiles and tourists for hard currency.

Shifting production to lower-cost countries is an old strategy for European carmakers. Renault already has “huge facilities” in Slovenia, Romania, Turkey and Russia, as well as Spain, says Mr Nassif. As wages rise there, cheaper north Africa is more tempting. By one estimate monthly labour costs for Renault workers in Romania or Turkey are around €950, compared with €350 in Morocco.

Other factors also help to explain Renault’s expansion. Carmakers are relying on sales in new markets to keep growing. African consumers are a long-term bet. To make vehicles that will appeal to their customers, carmakers like to keep production close so they can tweak to satisfy local tastes. “The main point is you must manufacture where you sell,” says Mr Nassif.

Cheap and well-trained locals and official munificence explain a boom in another manufacturing industry, aerospace. Its growth was also ordained by Morocco’s king just over a decade ago. Now some 100 firms, including Bombardier, Safran, UTC, Hexcel and Eaton, employ 11,500 people, mostly in a tax-free zone by Casablanca airport. An industry veteran says the goal is to double that workforce, at least, by the end of this decade.

Hamid Benbrahim el-Andaloussi, who heads the industry’s trade body, says a starting monthly salary in aerospace is equivalent to $400 or less, rising to $800 for middle managers. Fitting wiring is more akin to craft than mass production, so high-quality workers are crucial, too. Morocco’s government funds a facility run by the firms—similar to support for the car industry—to train some 800 workers each year. It is being expanded.

In Safran’s factory in Casablanca, workers assemble nacelles—structures encasing engines under aircraft wings—and fit honeycomb composites that help to muffle the screams of jet engines. The boss of Safran Nacelles in Morocco, Thierry Fradet, praises his expanding factory’s location, saying finished goods can reach Toulouse, Airbus’s headquarters, in southern France within three days, by lorry and ship.

Such industries are reshaping Morocco’s economy. But assembly does not bring the bigger gains of higher-value work, such as research and design, nor create a wider system of local suppliers. Mr Nassif expects local firms will eventually supply two-thirds of components at Renault’s Tangier plant, though he does not say when. Creating a supply chain is hard in aerospace, says a manager at Matis, a joint venture between Safran and Boeing for aircraft wiring. Suppliers are expected to share in the investment costs and risks of developing new components. The next job—getting small, local firms to flourish—will prove tougher than luring big foreign ones in the first place.