WASHINGTON — Erik Prince, the founder of the international security giant Blackwater Worldwide, is backing an effort by a controversial South African mercenary firm to insert itself into Somalia’s bloody civil war by protecting government leaders, training Somali troops, and battling pirates and Islamic militants there, according to American and Western officials.

The disclosure comes as Mr. Prince sells off his interest in the company he built into a behemoth with billions of dollars in American government contracts in Iraq and Afghanistan, work that mired him in lawsuits and investigations amid reports of reckless behavior by his operatives, including causing the deaths of civilians in Iraq. His efforts to wade into the chaos of Somalia appear to be Mr. Prince’s latest endeavor to remain at the center of a campaign against Islamic radicalism in some of the world’s most war-ravaged corners. Mr. Prince moved to the United Arab Emirates late last year.

With its barely functional government and a fierce hostility to foreign armies since the hasty American withdrawal from Mogadishu in the early 1990s, Somalia is a country where Western militaries have long feared to tread. The Somali government has been cornered in a small patch of Mogadishu by the Shabab, a Somali militant group with ties to Al Qaeda.

This, along with the growing menace of piracy off Somalia’s shores, has created an opportunity for private security companies like the South African firm Saracen International to fill the security vacuum created by years of civil war. It is another illustration of how private security firms are playing a bigger role in wars around the world, with some governments seeing them as a way to supplement overtaxed armies, while others complain that they are unaccountable.