DJIBOUTI — Above ground in this tiny but strategically located country, signs of China's presence are everywhere.

Chinese entities have financed and built Africa’s biggest port, a railway to Ethiopia and the country’s first overseas naval base here. Under the sea, they are building a cable that will transmit data across a region that spans from Kenya to Yemen. The cable will connect to an Internet hub housing servers mostly run by China’s state-owned telecom companies.

Beijing’s extensive investments in Djibouti are a microcosm of how China has rapidly gained a strategic foothold across the continent. Western countries, including Africa’s former colonizers, for decades have used hefty aid packages to leverage trade and security deals, but Chinese-financed projects have brought huge infrastructural development in less than a generation.

The construction is fueled mostly by lending from China’s state-run banks. Spindles of Chinese-paved roads have unfurled across the continent, along with huge bridges, new airports, dams and power plants as part of Chinese President Xi Jinping’s 152-country Belt and Road Initiative.

Overall, Chinese companies have invested twice as much money between 2014 and 2018 in African countries as American companies, spending $72.2 billion, according to an analysis by Ernst & Young.

“The Chinese are thinking far into the long-term in Djibouti and Africa in general,” said David Shinn, a former U.S. ambassador to Ethiopia who was also the State Department’s desk officer for Djibouti as far back as the late 1960s. “Djibouti is one node in an economic chain that stretches across the northern rim of the Indian Ocean, from ports in Cambodia to Sri Lanka to Pakistan. They have a grand, strategic plan. We don’t.”

In Djibouti, that strategic plan is all the more evident because of the country’s location at the entrance to the Red Sea, where about 10 percent of oil exports and 20 percent of commercial goods pass through the narrow strait right off Djibouti’s coast on their way to and from the Suez Canal.

That location has made it a crucial waypoint for undersea cables, which transmit data between continents. China’s investment in Internet infrastructure here comes as the region surrounding Djibouti is just starting to come online, including some places that are entirely reliant on Djibouti as a transit point for data transmission.

Opening the door to a small room with three servers, Habib Daoud Omar, an engineer who manages the site, said, “You are looking at all of Somaliland’s Internet,” referring to the autonomous region of northern Somalia. In another room, all of Yemen’s Internet. Ninety percent of powerful-but-landlocked Ethiopia’s Internet passes through the main chamber.

The transformative presence of China on so many fronts has loosened many African countries’ dependence on Western governments for development.

Chinese loans come without the demands for improvements on human rights that often accompany American aid. China’s inroads have helped it gain access to vital mineral resources, a vast market looking for its cheap goods located at the center of the world map, and reliable backing at global institutions such as the United Nations.

But critics of Chinese loans allege that they catch vulnerable, developing countries in “debt traps,” depleting government coffers and sticking generations of taxpayers with gigantic bills, or else China’s banks take ownership of the key strategic assets they built. Beijing now holds over 70 percent of Djibouti’s gross domestic product in debt.

African governments have fiercely denied that such takeovers could happen, despite recent precedent in Sri Lanka, where a port in the president’s strategically located but commercially unviable hometown was handed back to the Chinese company that financed its construction.

The Trump administration has sought to counter China’s growing influence with a push for private investment, called Prosper Africa, though the investments envisioned would pale in comparison to Chinese loans. In Djibouti, even the commander of U.S. armed forces in Africa has appealed — if obliquely — for greater caution in dealing with China.

“We look to build enduring relationships, not short term, nor transactional ones,” Gen. Stephen J. Townsend said on a visit to Djibouti this summer. “We lead with our values, hard work and a desire to strengthen partnerships on the African continent.”

The U.S. military’s main base in Africa, home to 4,000 personnel and a fleet of drones, has been in Djibouti for two decades. The United States has essentially paid hundreds of millions of dollars in rent for its base, where it stages fitful attempts to degrade al-Shabab in neighboring Somalia, but has done little else to develop the country.

While many African governments, including Djibouti’s, have expressed hope for greater American investment, Beijing puts its money where its mouth is, and cash-strapped African governments have turned east almost in unison. The Chinese leader now hosts an annual Forum on China-Africa Cooperation, attended by nearly all of Africa’s 54 heads of state. At the launch of Prosper Africa in Mozambique this year, the United States failed to send even a Cabinet secretary.

“Yes, our debt to China is 71% of our GDP, but we needed that infrastructure,” Mahamoud Ali Youssouf, Djibouti’s foreign affairs minister, said in a phone interview on the sidelines of a meeting in New York earlier this month, where Djibouti was pushing to gain a nonpermanent seat on the United Nations Security Council.

“It was quite natural that we raise our partnership with China. Neither Europe nor America were ready to build the infrastructure we needed. We’re projecting our country into the future and looking after the well-being of our people. Even the United States has trillions of dollars in debt to China, you know,” Youssouf said.

The most significant investment China has made in Djibouti is Doraleh Port, Africa’s biggest and deepest. As with Internet through the data center, a full 90 percent of landlocked Ethiopia’s imports now transit Djibouti, giving the minuscule country, with a population of less than a million, leverage over its gigantic, 100-million-strong neighbor.

And it isn’t just that Chinese banks control Africa’s largest port. Chinese companies are its main users.

“The majority of our shipping is coming from China,” said Aboubaker Omar Hadi, chairman of the Djibouti Ports and Free Zones Authority.

The paradox for many in the United States is that it is precisely the authoritarian political system in China, much maligned in Washington, that gives it an upper hand in economic competition. An added local irony for American policymakers is that the United States initially welcomed China’s presence in Djibouti as part of an international force to defeat rampant piracy in the region. Almost all of China’s investments in Djibouti have come after that mission ended.

“Trade, investment, politics, military are all closely linked in China’s foreign policy — that’s the way it is under the Communist Party,” said Joshua Eisenmann, an expert on China at the University of Notre Dame.

American banks are too risk-averse to make the large loans in Africa that China’s state-operated banks do, Eisenmann said. Especially under an administration that has been hawkish toward countering China on the global stage, there’s a fear that China could even one day use its leverage to hamper American access in places like Djibouti to its own bases.

“China has tools that the American government doesn’t — namely government-backed financing of loans,” said Shinn, the former U.S. ambassador. “I don’t care what Trump says — American trade in Africa is falling off a cliff. The whole Africa policy has that central flaw.”