CAIRO, Egypt — The United States is suddenly competing for influence over its most stalwart ally in the Middle East.

Newly elected Egyptian President Mohamed Morsi, charting a fresh course for the country both at home and abroad, chose Beijing for his first official visit outside the Middle East and Africa last week. He traveled with a battalion of businessmen and shored up unprecedented financial and political support from Chinese leader, Hu Jintao, including large-scale investments in infrastructure.

Following the high-profile, three-day visit, the Obama administration intensified efforts to relieve Egypt’s debt, including throwing its weight behind a $4.8 billion loan from the International Monetary Fund (IMF).

As Morsi recalibrates Egypt’s foreign policy — seeking “balance,” his advisers have said, and reaching out to US foes — he is attempting to relieve Egypt’s crippled economy, which has failed to rebound from its post-uprising slump.

More from GlobalPost: Egypt charts new course with Iran

China is now in a unique position to usurp the United States in the role of Egypt’s benefactor.

“Our relations with China will increase, because our new government has some doubts about the West,” said Mohamed Kadry Said, military analyst at the Cairo-based Al Ahram Center for Political and Strategic Studies.

For 30 years the US openly supported the dictatorial regime of former President Hosni Mubarak, which for decades persecuted the Muslim Brotherhood group to which Morsi belongs.

In November 2010, an opinion poll released by the Pew Research Center showed 52 percent of Egyptians held a favorable view of China, while just 17 percent of Egyptians held a favorable view of the United States.

Unfazed by political instability or concerns for human rights — unlike the United States, which still holds some reservations of the Morsi government — China has the money, the power, the will and the weaponry to rival American influence in Egypt.

“We are looking to China as a strong power not only in Asia, but also in Africa,” Said said, referring to China’s billions in trade and investment on the continent. “And this relationship will force the US to focus more carefully on what is happening in Egypt.”

The US remains Egypt’s largest donor, with both economic and military aid topping $1.3 billion. But China, long a bystander in the Middle East, is making inroads into both the economic and security sectors at a rapid pace.

In addition to signing on to build a power station, a water desalination plant and a high-speed train line between Cairo and Egypt’s second city, Alexandria — all last week — China has roughly $500 million in previous investments in Egypt.

More from GlobalPost: Could Morsi make peace in the Middle East?

Those investments were made during the Mubarak era, which embarked on trade ties with China but kept relations to a minimum under US financial and military patronage.

When Egypt’s popular revolt in 2011 and subsequent political turmoil spooked other investors, Chinese companies stayed behind, investing in affordable goods like clothes and cheap electronics.

With nearly 85 million people, Egypt is a lucrative consumer market for cheap Chinese goods. And in 2011, Chinese commodities exports to Egypt hit $7.28 billion, beating out US exports to Egypt at $6.18 billion, according to United Nations trade data.

“Chinese investment has catered to consumption [in Egypt], the one thing that remained resilient throughout the revolution and aftermath,” said an Egyptian economist who wished to remain anonymous.

As the US economy struggles to recover, and Europe — Egypt’s premier trading partner — faces its own economic crisis, China is flush with cash and a resilient export sector.

Egypt lacks the vast energy resources that have spurred mammoth Chinese investment elsewhere in the continent, including in Libya and Angola. But analysts say in addition to its profitable consumption market, Egypt offers China access — and leverage — to other nearby countries.

Fresh Chinese contributions to Egypt’s economy, which sits at the heart of the Arab world, will likely buy political goodwill in the region, where support for China is waning for its backing of Syrian President Bashar al-Assad.

More from GlobalPost: Egypt's other power struggle

China can also use Egypt’s Suez Canal to sail warships in the Mediterranean and Black Seas, where it also holds investments, challenging the preferential, expedited treatment US warships now receive when traversing the channel.

According to a study by the Norwegian University of Science and Technology, China sold more weapons to Egypt than Sudan and Zimbabwe — its traditional clients — combined, from 1989 to 2008, making Egypt China’s biggest weapons market in Africa.

The study says US military assistance to Egypt frees up cash for Egypt’s government to purchase additional Chinese arms. And some analysts are worried that increased Chinese presence in Egypt, coupled with a Morsi government less loyal to the United States, will give China access to American military technology.

According to a 2009 US diplomatic cable released by WikiLeaks, US officials were already concerned about Egypt’s Arms Export Control Act violations, stating they had “more violations than any country in the world.” The cable said a Chinese military official visited an Egyptian aircraft base in 2009, where F-16 fighter jets provided by the United States are held.

“The military aspect of our relationship [with China] is very strong,” said Said, the military analyst.

“Egypt is a key for any country who wants to reach Africa, or the Middle East or Europe,” he said. “A country like China can depend on a country like Egypt.”