* Latest attack in jihadist-plagued region kills 37 workers
* Security costs surge for foreign mining companies
* Quality gold and low costs still lure investors
* Local workers most vulnerable to attacks as expats fly in (Adds mine closure, updates share price)
NAIROBI/JOHANNESBURG/LONDON, Nov 8 (Reuters) - As jihadists wreaked ever more havoc in the last two years, mining firms in Burkina Faso rolled out extra security measures, from barracks for government troops protecting them to safe rooms for workers behind barbed wire and mounds.
Expatriates generally fly in and out, while local staff still drive but in guarded convoys.
That has added millions of dollars to security costs for foreign companies, mainly from Canada and Australia, operating in the West African nation where industrial miners are forecast to produce 60 tonnes of gold this year.
Yet this week's attack on a convoy ferrying hundreds of local employees and contractors from a mine owned by Canadas Semafo has exposed how vulnerable firms still are.
At least 37 civilians died, with another 60 injured and dozens more feared missing.
"This is the deadliest incident targeting the mining industry, or any private businesses, in the Sahel since the 2013 In Amenas hostage crisis," said Vincent Rouget, an analyst at Control Risks Group, referring to an attack on a gas plant in the Algerian desert that killed dozens of foreign hostages.
There has been no claim for Wednesday's ambush, but the modus operandi a bomb attack on military escorts followed by gunmen unleashing bullets suggested the involvement of Islamist groups.
They have been pushing south from strongholds in northern Mali to carry out attacks across much of Burkina Faso and parts of western Niger.
Over 1,000 people have been killed in Burkina Faso since 2016 and nearly 500,000 more have fled their homes, mainly this year. In this time, there have been dozens of attacks on industrial and small-scale mining operations.
After Wednesday's attack Semafo said its Boungou mine site remained secured, but it suspended operations there.
It is a dilemma for miners.
The region is seen as the gold industry's final frontier, with large untapped reserves.
Lured by relatively low-cost mining, Semafo and others like Barrick, IAMGOLD, Endeavour Mining, and Resolute Mining, have invested billions there over the last decade - but expansion by al Qaeda and Islamic State-linked militants could force them to rethink.
WORTH THE RISK?
"Because of the escalating security situation in Burkina, there are companies looking at decreasing their exposure to the country or leaving," said Bill Witham, the head of AAMEG, a body representing Australian resource companies in Africa.
"But the miners still see West Africa as a whole as quite a good investment."
Semafo's Toronto-listed shares have fallen 17 percent since the attack. And major mines just over the borders in northern Ghana and Ivory Coast are now within striking distance of Islamist strongholds, experts warn.
Last year, AQIM, the main al Qaeda affiliate in West Africa, told followers Western companies, especially from France, were "legitimate targets".
Semafo, whose staff, contractors or escorts have been attacked three time in the last 18 months, declined to comment further, saying only that it had beefed up security since those episodes.
Eight other companies contacted by Reuters around the Sahel would not give details of their extra security costs.
West Africa has long been considered a risky prospect where political instability, volatile tax regimes and tricky relations with small-scale miners weigh heavily on boardrooms.
Yet government incentives and the potential to produce gold relatively cheaply led to over $7 billion invested in mining projects in the region between 2004 and 2018, according to a tally by S&P Global, a market intelligence company.
This peaked at $1.2 billion in 2012, when gold prices were at an all-time high.
That year, al Qaeda-linked groups took over northern Mali but gold operations were unscathed as most mines are in the south, hundreds of kilometres away from militant strongholds.
Since then, France has deployed over 4,000 troops to the region, there is a 16,000-strong United Nations peacekeeping mission in Mali, and West African leaders have launched regional security initiatives. However, local armies are losing ground.
Since 2017, researchers documented at least 28 violent incidents at mines or involving mining workers in Burkina Faso, 17 of them this year, according to a Reuters analysis of data compiled by the Armed Conflict Location & Event Data Project.
At least 12 of those events this year, which include attacks on workers, abductions and the use of improvised explosive devices, were linked to jihadists. Prior to Wednesday, at least 54 people had been killed in mining-related violence this year, five times as many as all of 2018.
"BRACING FOR AN ATTACK"
This has forced the industry to accept that the threat has spread well beyond Nigers northern deserts, where the likes of Frances's Areva have uranium mining operations and expatriates have been kidnapped, said Rouget.
In October 2018, France scrambled two jets to strike militants attacking a gold mine in northern Burkina Faso.
Earlier this year, Burkina Faso's government asked mining firms to help fund a rapid reaction unit with helicopters to respond to incidents like Wednesday's, but the initiative did not materialise, according to two people involved in meetings.
One company security official said his firm spent millions of dollars on armoured vehicles, bullet-proof walls and safety rooms. "We are bracing for an In Amenas-style attack," he said.
However, some still think it's a gamble worth taking.
The top investor in Semafo said risk and gold mining went hand-in-hand, and extra security costs would not be a game-changer.
"Obviously it will add maybe a few dollars to the cost of producing an ounce of gold, but it is not going to change the overall economics," said Joe Foster, gold fund portfolio manager at VanEck Investment Management, which has a 10.1% stake in Semafo and a 9.8% stake in Endeavour, another Canadian firm with two mines in Burkina Faso.
One immediate impact could be restrictions on how far afield firms are prepared to send geologists.
In May, Oumarou Idani, Burkina Fasos minister of mines, identified exploration companies as high risk. "They work over large areas, sometimes 250 square kilometres ... it is difficult to have a secure way of working over that size of area."
Months earlier, Kirk Woodman, a Canadian geologist with 20 years' experience in the region, was kidnapped and found dead.
That was a "a big wakeup call", a former senior mining executive who is now an investor told Reuters.
"Miners are going to risk exploring further afield a lot less now," he said, asking not to be named. "This will affect how many new gold deposits are found."
(David Lewis in Nairobi, Helen Reid in Johannesburg, and Zandi Shabalala and Ryan McNeill in London; Editing by Andrew Cawthorne)