Antipiracy Soldiers Stranded in Somalia United Nations Monitoring Group on Somalia and Eritrea A trainee at a camp in Somalia in October 2010. The camp was run by Saracen International, a South African military firm. WASHINGTON - It seemed like a simple idea: In the chaos that is Somalia, create a sophisticated, highly trained fighting force that could finally defeat the pirates terrorizing the shipping lanes off the Somali coast. But the creation of the Puntland Maritime Police Force was anything but simple. It involved dozens of South African mercenaries and the shadowy security firm that employed them, millions of dollars in secret payments by the United Arab Emirates, a former clandestine officer with the Central Intelligence Agency, and Erik Prince, the billionaire former head of Blackwater Worldwide who was residing at the time in the emirates. And its fate makes the story of the pirate hunters for hire a case study in the inherent dangers in the outsourced wars in Somalia, where the United States and other countries have relied on proxy forces and armed private contractors to battle pirates and, increasingly, Islamic militants. That strategy has had some success, including a recent offensive by Kenyan and African Union troops to push the militant group Al Shabab from its stronghold in the port city of Kismayu. But with the antipiracy army now abandoned by its sponsors, the hundreds of half-trained and well-armed members of the Puntland Maritime Police Force have been left to fend for themselves at a desert camp carved out of the sand, perhaps to join up with the pirates or Qaeda-linked militants or to sell themselves to the highest bidder in Somalia's clan wars - yet another dangerous element in the Somali mix. A United Nations investigative group described the effort by a companie based in Dubai called Sterling Corporate Services to create the force as a "brazen, large-scale and protracted violation" of the arms embargo in place on Somalia, and has tried to document a number of grisly cases in which Somali trainees were beaten and even killed. In one case in October 2010, according to the United Nations group, a trainee was hogtied with his arms and feet bound behind his back and beaten. The group said the trainee had died from his injuries, an accusation disputed by the company. Sterling has portrayed its operation as a bold private-sector attempt to battle the scourge of piracy where governments were failing. Lafras Luitingh, a senior manager for the project, described the October 2010 occurrence as a case of "Somali-on-Somali violence" that was not indicative of the overall training program. He said that the trainee had recovered from his injuries, and that "the allegations reflect not the professional training that occurred but the fact that professional training was needed," he said. A lawyer for the company, Stephen Heifetz, wrote an official response to the United Nations report, calling it "a collection of unsubstantiated and often false innuendo assembled by a group with extreme views regarding participants in Somali politics." Sterling officials have pointed out that in March, a United Nations counterpiracy organization - a separate entity from the investigative group that criticized Sterling - praised the semiautonomous Somali region of Puntland for creating the program. Moreover, the company argues, Somalia already is a playground for clandestine operations, with the C.I.A. now in the midst of an extensive effort to arm and equip Somali spies. Why, they ask, is Sterling Corporate Services singled out for criticism? Concerned about the impact of piracy on commercial shipping in the Middle East, the United Arab Emirates has sought to take the lead in battling Somali pirates, both overtly and in secret by bankrolling operations like Sterling's. American officials have said publicly that they never endorsed the creation of the private army, but it is unclear if Sterling had tacit support from parts of the United States government. For instance, the investigative group reported in July that the counterpiracy force shared some of the same facilities as the Puntland Intelligence Service, a spy organization answering to Puntland's president, Abdirahman Farole, that has been trained by C.I.A. officers and contractors for more than a decade. With the South African trainers gone, the African Union has turned to a different security contractor, Bancroft Global Development, based in Washington, to assess whether the pirate hunters in Puntland can be assimilated into the stew of other security forces in Somalia sanctioned both by the United States and the African Union. Among those groups are a 10,000-man Somali national army and troops of Somalia's National Security Agency, based in Mogadishu, which is closely allied with the C.I.A.