DURING the 1980s Leon Lotz fought for the “Koevoet” (“crowbar” in Afrikaans), a South African apartheid-era paramilitary unit charged with rooting out nationalist guerrillas in what is now Namibia—acting as “the crowbar which prises terrorists out of the bushveld like nails from rotten wood,” in the words of South Africa’s then minister of law and order, Louis le Grange.

Such skills should today serve handily on the front line of Nigeria’s campaign against Boko Haram, whose fighters hide in the difficult bushland of the country’s remote north-east. Mr Lotz died there this month, reportedly killed by “friendly fire” from a Nigerian tank, along with an unnamed Namibian man, said to be his Ovambo driver.

There are believed to be hundreds of foreigners—from South Africa, Ukraine and other ex-Soviet republics—engaged in Nigeria as private soldiers. It is unclear whether they are taking active roles in fighting, as several reports say, or simply providing training and technical support for foreign-bought weapons, as the Nigerian government claims. South African-made armoured vehicles have been sighted in and around the city of Maiduguri.

Bringing in experienced hired guns may be a clever move by Nigeria’s army. It has performed abysmally against Boko Haram. But in a renewed campaign over recent weeks, which delayed the presidential election now set for March 28th, the army has made significant headway in the war. The Nigerian government credits its own forces, but much of the progress seems to have been helped by foreign contractors, as well as military intervention by neighbouring armies, especially Chad’s, backed by aerial intelligence from France and the United States. “They wanted results,” said Jakkie Cilliers of the Institute for Security Studies, a think-tank in Pretoria. “This is about working in an environment with very limited infrastructure. It’s about tracking and bushcraft.” The South Africans “have many skills in that regard”.

In the dying days of apartheid a stream of white South African ex-soldiers sought to ply their trade in conflicts abroad. The best-known mercenary outfit was Executive Outcomes, which in the 1990s fought rebels on behalf of Angola and Sierra Leone, to controversial but often impressive effect. These soldiers of fortune, with experience drawn from subjugating the black majority, were an embarrassing export for the post-apartheid rulers of South Africa. An “anti-mercenary” law, the Regulation of Foreign Military Assistance Act, was enacted in 1998 and toughened in 2006.

The defence minister, Nosiviwe Mapisa-Nqakula, who herself underwent foreign military training in the 1980s (in Angola and the Soviet Union) as a member of the African National Congress’s armed wing, has threatened any South African helping Nigeria’s military with arrest upon return home. “They are mercenaries whether they are training, skilling the Nigerian defence force or scouting for them. The point is they have no business to be there,” she said in January.

The anti-mercenary code is rarely questioned, although its flaws are apparent. Violations are hard to prosecute. South African citizens serving in the Israeli and British armed forces have been threatened with prosecution.

Sometimes foreign mercenaries have been saviours—for instance in Sierra Leone, when a privately hired helicopter-gunship crew helped to save the capital, Freetown, from falling into the hands of hand-chopping rebels in 2000. Soldiers of fortune will always find their way to war. Regulating them, rather than trying to ban them, might be a better solution on a continent that has too few effective regular soldiers of its own.