The U.S. military is embarking on a long-term push into Africa to counter what it considers growing inroads by al Qaeda and other terrorist networks in poor, lawless and predominantly Muslim expanses of the continent.

The Pentagon plans to train thousands of African troops in battalions equipped for extended desert and border operations and to link the militaries of different countries with secure satellite communications. The initiative, with proposed funding of $500 million over seven years, covers Algeria, Chad, Mali, Mauritania, Niger, Senegal, Nigeria, Morocco and Tunisia -- with the U.S. military eager to add Libya if relations improve.

The Pentagon is also assigning more military officers to U.S. embassies in the region, bolstering the gathering and sharing of intelligence, casing out austere landing strips for use in emergencies, and securing greater access and legal protections for U.S. troops through new bilateral agreements.

The thrust into Africa is vital to head off an infiltration by international terrorist groups, according to senior U.S. military, Pentagon and State Department officials. The groups are recruiting hundreds of members in Africa and Europe, attacking local governments and Western interests, and profiting from tribal smuggling routes to obtain arms, cash and hideouts, they say. Meanwhile, small groups of Islamic radicals are moving into Africa from Iraq, where Africans make up about a quarter of the foreign fighters, the officials say.

Foreshadowing a new phase in the war against terrorism, the Pentagon plan is to mobilize Africans to fight and preempt militant groups while only selectively using U.S. troops, who are already taxed by operations in Iraq and Afghanistan. But in mustering African forces, the U.S. military confronts not only a highly elusive enemy across a vast, desolate terrain but also the competing agendas of authoritarian African governments and corrupt and chaotic militaries on the ground.

Training With GI Joes

"Arretez!" yelled Sgt. 1st Class Brian of the U.S. Army Special Forces, waving his arms at a squad of Chadian soldiers bounding over a dirt berm in a windblown stretch of desert south of Chad's capital, N'Djamena.

It was the first mock assault of the morning, and the Chadians, wearing mismatched uniforms, appeared to have forgotten every element of what the Americans had taught them. They were spread out too widely, standing up on the berm instead of crawling low, and their squad leader was omitting crucial orders.

"Tell them to check their men" for wounds, Brian shouted to an interpreter. It was only 7 a.m., but the energetic young Green Beret from Baltimore was exasperated. Citing security risks, the U.S. soldiers spoke on condition that only their first names be used.

Brian and about 1,000 other U.S. troops fanned out into North and West Africa last month for a major exercise to lay the groundwork for the Trans-Sahara Counter Terrorism Initiative, approved this spring. In three weeks of initial training, Brian's team from 10th Special Forces Group and a team from the National Guard's 20th Special Forces Group glimpsed the challenge ahead in Chad, the world's fifth-poorest country and, according to the anti-corruption group Transparency International, the third most corrupt.

"It was like going to Mars," said Sgt. 1st Class Gary, a welder from Utica, N.Y., on the National Guard team.

Green Berets are trained to navigate foreign cultures, but both teams lacked Africa expertise and were short on French and Arabic speakers. Each team was designed to have 12 members, but Gary's had nine men and Brian's had six. They were given the assignment on short notice after the 3rd Special Forces Group, which normally covers Africa, was deployed to Iraq.

They landed in Chad with outdated U.S. military maps that still labeled the current capital, N'Djamena, with its French colonial name, Fort Lamy. To keep from getting lost, Gary fashioned his own crude map by plotting GPS coordinates for stores and gas stations. U.S. soldiers are relative newcomers in Chad, where France has had 1,000 troops and three air bases.

After scouting out the cacophonous, crime-ridden capital, with its Internet cafes and dilapidated French cinemas, the soldiers concluded that it was ripe for terrorists. Worshipers outside the grand mosque denounced the war in Iraq. Booksellers sold Islamic fundamentalist tracts and photocopied images of a girl transformed into a large rat because she threw a Koran, the Islamic holy book, on the floor.

Across the Chari River, youths ran a brisk operation smuggling sugar from Cameroon into N'Djamena markets under the noses of Chadian customs guards.

Arms traffickers move easily across Chad's 3,500 miles of unguarded borders, and airport security is lax, U.S. officials say. "This place is so easy to move through," observed Sgt. 1st Class Jasper, an intelligence soldier with the 10th Special Forces Group team, which will prepare a classified report on its mission.

From N'Djamena, the U.S. troops headed south across the broad, meandering Chari River. Pushing into the desert, they moved into two mud-brick military camps inhabited by livestock and camel spiders as big as a man's fist. There, they found Chadian forces as disorganized as they were ill-equipped. Ranging from 14-year-old boys to men pushing the limits of Chad's male life expectancy, 46 years, some had zero experience and others were combat veterans of Chad's decades-long civil war. They wore everything from Vietnam-era tiger-stripe uniforms to gym clothes, along with flip-flops, boots, dress shoes or no shoes.

Gary's team trained a group of 160 men equipped with 23 AK-47 assault rifles. Some aimed with the wrong eye and fired wildly, but most learned to shoot and clean the guns. Brian's team worked with a more experienced battalion of 200 men outfitted with weapons, radios and 13 Toyota trucks. They appeared enthusiastic but still lacked basic skills. So, the Americans started demonstrating tactics using GI Joe action figures in the sand, until one day the Chadians appeared ready for a platoon-size attack on "the Cardboardians," a row of cardboard torsos set in tires.

"The biggest thing is making sure they don't shoot each other," said Jasper, striding through the brush preparing for a live-fire drill. Nicknamed the Big One by Chadian troops, Jasper, from rural West Virginia, has bushy sideburns and a short fuse. When the Chadians refused to aim their rifles properly, relying instead on what Jasper calls "Kentucky windage," he swore at them and made them back up 100 yards to prove they could not hit their targets.

As the Chadian soldiers loaded their ammunition, small muddy pigs trotted across the makeshift firing range. Sgt. 1st Class Brett, the team engineer, shooed away children from a nearby village who had gathered to scavenge for bullet cartridges.

A squad of Chadian soldiers, crouching low, began moving toward the target. But suddenly, before the signal had been given, a machine gunner on their flank started shooting. His ammunition ran out before the assaulting squad got into position -- leaving them dangerously vulnerable. Jasper shook his head and ordered the squad that misfired to practice again without ammo.

"Bang! Bang! Bang-bang-bang!" the Chadian soldiers shouted.

Jasper, Brian and the rest of the team gathered under the shade of a feathery shamis tree, offering a scathing critique of the morning. "Mistakes happen," Jasper said with a sigh.

Later, a Chadian soldier asked Brian, "Why is the Big One always so angry?"

Conflicting Agendas

A gust whipped a billow of dust across the blistering hot range, and out of nowhere, Lt. Abdullah Issa Djerou whirled into action. After hanging back for weeks during the training, the short, stern-faced Chadian officer suddenly took command, barking orders to a squad of men rushing a target.

Brian cringed behind his sunglasses at Djerou's encroachment on the squad leader's authority. He pulled Djerou aside and advised him to let the squad leader do his job. Djerou is only a lieutenant but serves as the battalion's executive officer -- a mystery to the Americans until they discovered that he belongs to President Idriss Deby's small but powerful ethnic group, the Zagawa.

Grooming effective military leaders is as central to the U.S. mission in Chad as teaching infantry tactics, U.S. officials say. But the job is complicated because Chad's army -- like the rest of the government -- is run top-down by the feared Zagawa tribe.

Indeed, many of the U.S. goals in Chad appear to conflict with the Zagawa leaders' imperative to stay in power. Across the region, some of the governments the U.S. military is working with have embraced counterterrorism as a way to stifle legitimate dissent and Muslim groups, according to reports issued by the International Crisis Group.

The U.S.-trained battalion is commanded by Deby's nephew, Maj. Hardja Idriss, and is part of a regiment assigned to protect an authoritarian and increasingly unpopular president. Deby survived an attempted coup last year, and his grip on power remains fragile. "It just makes sense. They're the president's guard, and so in this region, with all the coups and stuff, you'd want them the best trained," said Capt. Jason, the team leader.

U.S. officials said the battalion is based in N'Djamena to safeguard the government and prevent its vehicles from falling into the hands of regional commanders. The unit has performed limited border patrols, but its stationing in the capital conflicts with the Pentagon's goal of pushing militaries into "ungoverned spaces" across the Sahara. Moreover, Idriss, the battalion commander, said the unit is not authorized to stop smugglers, although it confiscates hundreds of weapons, mainly from rebel militias.

Chad's leaders maintain that foreign-backed rebels constitute their main terrorist threat, as opposed to the transnational networks of anti-Western Islamic extremists. "When others use you to fight against your country, they are terrorists," Security Minister Abderahman Moussa said in an interview, wearing a silken gold caftan.

Moussa and Chadian army leaders say they fear that Sudan and other countries may be supporting as many as 4,000 anti-government rebels near Chad's volatile eastern border, where makeshift shelters teem with 200,000 Sudanese seeking refuge from government-backed militias and troops in Sudan's western Darfur region. "For a long time, they say they will take over Chad," said Col. Abakar Youssouf Mahamat Itmo, commander of the presidential guard and Deby's cousin.

Yet in subduing opponents, the government and its security forces commit serious human rights abuses, according to U.S. officials and human rights reports. "It's very important for us to remain very, very watchful over this issue of how the military and police respect civilians," said U.S. Ambassador Marc M. Wall. Embassy officials said the United States checks the names of troops it trains against news reports and U.S. government records.

Chadian officers admit the 25,000-member army is ill-disciplined, bloated and corrupt. "There are criminals in his tribe, in the military . . . and they do steal and rape people," said Maj. Soumaine Adam Ahmed, who took military classes in the United States. "The people say: 'Why don't you take a decision against them?' They are very unhappy about that."

'Cardboardian' Adversaries

It was the last day of training, and everyone seemed happy.

Jasper was smiling because the mobile target he and Brian had rigged up -- a tin sled mounted with Cardboardian adversaries and dragged by a rope from an SUV -- was working perfectly. The Chadian soldiers were happily blasting the target with machine guns and AK-47s, filling the desert air with the smell of gunpowder -- which made Jason especially happy, because he said he did not want to leave behind any U.S. bullets in Chad.

"They asked us every single day to leave the ammo, but we can't," Jason said. "All I need is a lot number to tie back to U.S. ammo" in the event it is misused.

Dashing down from the berm, the Chadian soldiers clambered into a Toyota truck, hanging on as it lurched and sped off across a desert path.

"Morale! Morale!" they chanted in French, ignoring Brian's warning to make a stealthy retreat.

U.S. and Chadian soldiers acknowledge that although the battalion made good progress in learning basic maneuvers, it remained unable to track international terrorists. The Pentagon plans to supply intelligence on targets and let the Chadians do the fighting, a strategy that has been tested in at least one successful operation.

Squatting under a mim tree, Sgt. Mohamed Nour Abakar, 28, sketched lines in sand moist from a desert rain, describing how he served as one of America's African fighters in a battle against terrorists in March 2004.

"I was between the border of Chad and Libya. . . . It was about 3 p.m.," he said, when his regiment received intelligence from a U.S. Navy surveillance plane on the location of 80 fighters from an Algerian group affiliated with al Qaeda. The fighters, from the Salafist Group for Call and Combat, were wanted for the kidnapping of 32 European tourists in southern Algeria in 2003.

At 6 p.m., about 150 Chadian soldiers first spotted the guerrillas, who were traveling in eight Toyota trucks mounted with heavy machine guns. "We found the Salafists hunting gazelle. When they saw us, they left the gazelle and began to shoot at us with machine guns," Abakar said.

Just then, Abakar recalled, the guerrilla commander hurled an insult -- and an appeal. "You monkeys! We are not your enemy, we are America's enemy," he yelled. "It was our mistake to fire at you, so why are you chasing us? We are all African!"

But the Chadians fought on. They pursued the guerrillas into the hills for two days, killing 28 of them and capturing seven, Abakar said. The Chadians lost 20 men, and Abakar was shot in the chest. "I was about to give up and be a civilian," he said, "but I found out the Americans were coming with new training, so I joined again."

At a closing celebration, the Chadians invited the Americans to a feast of goat stuffed with couscous and washed down with local beer. In a ceremony that followed, Abakar goose-stepped forward, clicked the heels of boots held together with staples, and swirled up his arm in salute. Jasper returned an easy salute.

But it wasn't goodbye: Next month, at an old French commando school north of N'Djamena, they'll be training together again.

A U.S. Army Special Forces soldier uses GI Joe toys to demonstrate tactics during a training session with Chadian soldiers south of the capital. It is part of a $500 million Pentagon initiative to provide counterterrorism training to soldiers in North and West Africa.A U.S. Special Forces soldier provides rifle training to a Chadian soldier. About 1,000 American soldiers were deployed across North and West Africa last month to lay the groundwork for a multi-year counterterrorism initiative.