Just an hour's ride in a fast boat from Yemen, Osama bin Laden's ancestral homeland, the United States is building an extensive military task force in Djibouti to combat al Qaeda, highlighting Africa's crucial role in the war on terrorism.

In the middle of Djibouti's desert and around its strategically situated port, 3,200 U.S. Marines, Special Forces troops and Air Force pilots have come together in this former French colony on the Horn of Africa. They are part of a U.S. joint task force for the region, a special military command to track down suspected terrorists in neighboring African countries as well as in Yemen, 30 miles across the Bab al-Mandab strait.

Since ancient times, Djibouti has been prime real estate, with a military importance that belies its size. The Muslim country, which gained independence from France in 1977, covers just under 9,000 square miles, much of it wasteland. But it is surrounded by Eritrea, Ethiopia and Somalia, it looks across the Bab al-Mandab toward the oil-rich Arabian Peninsula, and it opens to the Red Sea northward and the Indian Ocean southward.

In addition, 500 miles to the south lies Kenya, where a suicide bombing claimed 16 lives on Nov. 28 near the port city of Mombasa. Though it has not been solved, foreign intelligence sources have suggested the bombing and an almost simultaneous missile attack on an airliner leaving Mombasa's airport may have been the work of al Qaeda or al-Ittihad al-Islamiya, a Somali group with reported links to bin Laden's network. The Americans' presence here is partly because of concern about al-Ittihad's activities in Somalia, a largely lawless nation that shares a porous border with Djibouti.

Charging into sand caves and belching dust balls as they perform live-ammunition exercises, 2,400 Marines from the 24th Marine Expeditionary Unit have landed their beige tents and helicopter gunships here, simulating war and practicing how to capture terrorist suspects. Their training also takes into account the fact that they could be called into service if there is a war with Iraq.

"This is a very important environment and terrain for the troops to learn and understand," said Capt. Dan McSweeney, standing in the sprawling camp at Khor Angar, 40 miles north of Djibouti city, the capital, as a camel lumbered across the sand. "We want to be prepared for anything."

Meanwhile, 800 Special Forces troops trained to conduct clandestine attacks have taken over Camp Lemonier, a French air base near the airport that serves Djibouti city. U.S. contractors there are building showers, bathrooms and a swimming pool, indicating that the U.S. forces plan to stay awhile. The amphibious command ship USS Mount Whitney, with 600 Marines aboard, is scheduled to arrive here from Norfolk this month.

Some of the Marines said they are being trained in biological and chemical warfare and in techniques to fight bomb attacks.

"We learned what to do if there was chemical war," said Cpl. Sambo Tithe, 22, from Silver Spring. "We were also trained in how to fight in caves and how to spot terrorist attacks on sea and land. It's like a slide show for fighting terrorism."

The Horn of Africa's impoverished nations yearn to cooperate with and receive aid from powerful Western countries. But they also retain strong cultural and religious ties to the Muslim world.

Djibouti is a member of the Arab League. Five times a day, the call to prayer rings out. During the month-long observation of Ramadan, daily life in this already sleepy nation -- with its four-hour workdays and eight hours that many people spend chewing the intoxicating leaves known as qat -- has slowed even more.

Djibouti has a population of about 473,000,. divided mainly between the Issa tribe, which is ethnically Somali, and the Afar tribe, a nomadic group linked to Ethiopia. The only cinema in the capital was recently showing "Black Hawk Down" on its outdoor screen, a movie depicting a battle that claimed 18 American lives in Mogadishu, the Somali capital, in 1993 and may have involved al-Ittihad, according to intelligence assessments. U.S. intelligence agents said they are monitoring Djibouti's large Somali immigrant population.

Djiboutian officials said they want to help the United States fight terrorism, asserting they were the first country to contact the United States after the Sept. 11, 2001, attacks and offer use of the country's ports.

"We have a strategic position, and we want to use it to ensure peace," said Prime Minister Dileita Mohamed Dileita. "With the Americans and the Europeans, we will try to do our best to fight terrorism in Djibouti and the region."

Since the Sept. 11 attacks, a multinational unit called Task Force 150, now commanded by Spanish officers, has been patrolling sea lanes used to transport U.S. war materials to the Persian Gulf. The lanes are potential danger zones since al Qaeda attackers use the seas to hide and transport their materials, said Rear Adm. Javier Romero, chief of staff of Task Force 150.

Along with the American troops, the Spanish navy is closely watching Yemen, a known hiding place for al Qaeda followers and the site of the October 2000 bombing of the USS Cole that killed 17 U.S. sailors.

"The threat is very serious in my opinion," Romero said. "Our job here is to deny terrorists the use of these very important waterways."

The CIA is also in Djibouti, where its operatives directed a Predator drone equipped with Hellfire missiles into Yemen on Nov. 3 to kill an al Qaeda activist, according to diplomatic sources.

Dileita, in an interview, denied reports that the drone was dispatched from Djibouti. He said his country does not support launching attacks into Yemen. Djibouti, he added, is in a risky position with its Muslim neighbors.

"We don't want an amalgam of Islam and terrorists," Dileita said. "If today there was an attack from here into Yemen, American authorities would have to know that they would need U.N. permission."

Although the government has pledged its cooperation, U.S. forces gathering here have found themselves in a country that Arthur Rimbaud, the French poet, called "this awful colony and filthy country."

Djibouti, a country of sweltering heat and arid desert stretches where scratchy plants occasionally sprout, produces almost nothing and imports almost everything it needs. Although unemployment exceeds 50 percent, prices are shockingly high. Beverages such as sodas and fruit juices cost the equivalent of $6. Thirty-minute taxi rides can cost $60.

Some Djiboutians see the arrival of U.S. troops -- with the dollars they would spend in food shops, hotels and the souvenir markets that line the town -- as a chance to boost the economy and create jobs. The supplemental U.S. defense budget passed March 21 includes $373 million for counterterrorist financing in Djibouti, Ethiopia and Kenya. U.S. officials declined to say how big Djibouti's slice will be.

Djiboutians say they want it to be used for aid projects, such as improving water and roads. Some foreign and local relief workers are upset that funds from the U.S. Agency for International Development, which were slated to help herders vaccinate their cattle, are being diverted to sprucing up the airport with computerized equipment and air traffic controls. Djibouti has the highest infant mortality rate in Africa.

"It's like this in a lot of African countries," said Mohamed Abwais, director of tourism for Djibouti. "They come, they take and they go. But we can't say no to America. You say no to President Bush and then, poof, no Djibouti. The thing we need is more of a bridge between the two people."

Some Djiboutians complained that U.S. troops are not seen around town and are not spending money in the shops. The Spanish and German troops here with Task Force 150, they pointed out, are often seen eating at outdoor fish stands.

In Obock, north of the capital across the Gulf of Tadjoura, protests broke out when U.S. troops wanted to use the port and Djiboutian traders feared that the Americans would interrupt distribution of qat imported from neighboring Ethiopia. U.S. military officials countered that they have already moved their dock at Obock and that they do not go out much because of a security threat.

To ease tensions, Marines in Obock repaired a school, building new desks and chairs in a one-day humanitarian gesture. During the rebuilding, some Marines handed out packets of chocolate to children in the town. Most Marines did not realize it was Ramadan and that many children were fasting or at least abstaining from eating sweets from sunup to sundown.

One mother chuckled wearily as her children ripped open the packet and shoved the chocolate into their mouths. "We will have to get used to each other," said Jocylen Ibrahim Omaha, 27, whose home sits a few steps from where the Marines were working. "I think they might be here a long time."

Rear Adm. Javier Romero of Spain is chief of staff of the multinational Task Force 150, which is patrolling sea lanes off the Horn of Africa used to transport U.S. military supplies to the Persian Gulf region.