We sure have come a long way since “Out of Africa” and “The Flame Trees of Thika.”

In the second decade of the 21st century, a lot of compelling contemporary crime-fiction novels are either set in or coming from Africa.

Cape Town’s Roger Smith, who writes with the brutal beauty of an Elmore Leonard in a very bad mood, is at the forefront. His 2009 debut, “Mixed Blood,” has been optioned for a film starring Samuel L. Jackson and directed by Phillip Noyce (“Patriot Games,” “Clear and Present Danger”). His second book, “Wake Up Dead,” is also going Hollywood, with director Mark Tonderai (“Hush”) attached.

Meanwhile, his third novel, “Dust Devils,” has just been released as an e-book in the United States. All of this follows releases in the past year or so from Ghanaian-born/U.S.-based Kwei Quartey (“Children of the Street”), Nigeria’s Adimchinma Ibe (“Treachery in the Yard”), and South Africa’s Mike Nicol and Joanne Hichens, who write under the name Sam Cole (“Cape Greed”).

Coming this month are new works from Deon Meyer (“Trackers”) and fellow South Africans Michael Sears and Stanley Trollip, who write under the name Michael Stanley (“Death of the Mantis: A Detective Kubu Mystery”), and Kenyan-raised/U.S.-based Mukoma Wa Ngugi (“Nairobi Heat”). Just as the works of James Ellroy and Carl Hiaasen dig beneath the glitter of Hollywood and South Beach, respectively, to reveal a nasty, fetid underside, these books rip away images of the Sahara and safaris and go beyond nightly news pictures of deprivation.

’Nairobi Heat’ by Mukoma Wa Ngugi. (Melville House/MELVILLE HOUSE)

While many Americans may have been introduced to African-set crime fiction through Alexander McCall Smith’s polite “The No. 1 Ladies Detective Agency” books and the subsequent HBO series, some of this new wave is often far less soft-centered and more hard-boiled.

We spoke recently with Smith and Ngugi about their lives, work and what it means to plug into an Anglo-American genre and rewire it into an African context.

Screenwriter and director Roger Smith, 51, came of age in Johannesburg as a fan of American noir writers such as Jim Thompson. But he was wary of trying his hand at it.

“I grew up in South Africa during the apartheid era, and, if you wanted to talk about crime, you had to talk about the biggest crime there was — apartheid,” he says by phone from Thailand, where he spends part of the year. “To write crime fiction, in the classic sense, about guys shooting each other over money, would have been inappropriate.”

But after apartheid officially was lifted in 1994, Smith, who is white, began to think that the time might be right, and about five years ago he sat down to pen “Mixed Blood.” He certainly had enough inspiration from his surroundings; crime often dominates the headlines in Johannesburg and Cape Town, where Smith now lives. He writes of a world of residual racism and vicious gangland violence, the latter often fueled by tik, the South African version of meth.

It’s a hellish vision that has earned him criticism from some South Africans who feel he gives the place a bad name. “Sadly, South Africa creates a negative impression of itself,” he says. “Statistics don’t lie, and the crime statistics for South Africa are really shocking, especially when it comes to violent crime. . . . A South African woman is more likely to be raped than learn to read. It’s important to discuss that.”

But that atmosphere may be too bleak for American publishers. While his first two books were published by Henry Holt, “Dust Devils” — about a Cape Town man, with a dad from Texas, who is turned into an avenging angel after his family is slaughtered — is only available as an e-book so far.

For Mukoma Wa Ngugi, who was born in the United States and lives here now but was raised in Kenya, crime fiction was one of the few options available during the Daniel arap Moi regime of the ’80s.

“During the Moi dictatorship, a lot of literary writers went into exile,” says Ngugi, 40, in a phone interview from his Connecticut home. “Most of my generation, we read Shakespeare and African classics, but it was popular fiction that took the place of literary fiction.”

Now, with “Nairobi Heat,” which was published by Penguin in South Africa in 2009 and is being published in the United States by Melville House this month, Ngugi gets to join the ranks of crime writers he has long admired. In the book, he tells the story of Ishmael, an African-American detective who has to go to Kenya to investigate a case.

“I’ve always wanted to pay homage to that genre, and what those writers could do was sneak politics in,” says Ngugi, the son of Kenyan novelist/critic Ngugi wa Thiong’o, a political columnist for BBC’s Focus on Africa magazine and, until recently, a part-time lecturer and fellow in the English department at Ohio’s Case Western Reserve University. “I was able to deal with issues, as the detective is African-American so there are issues of race, and then [when he goes to Kenya], there are issues of identity of poverty.”

Ngugi, who’s working on a “Nairobi Heat” sequel, is aware that there appears to be a wider market for African fiction, but he says it is hamstrung by lingering stereotypes.

“I don’t know if there’s a ready market for hard-core, violent and hard-hitting African fiction,” he says. “Ultimately, there’s this idea that African literature has to be functional and deal with issues of colonialism. But we have to allow it to be many things — science fiction, detective fiction. We have to allow it to flourish and go in any direction.”

— Fort Worth Star-Telegram