(CNN) -- The U.S. relationship with President Hosni Mubarak's Egypt is full of contradictions and tensions, according to recently published U.S. diplomatic cables, but is also underpinned by similar basic interests in a rough and unpredictable part of the world.
A CNN analysis of secret and confidential cables published by WikiLeaks and its media partners reveals U.S. frustration with Mubarak's lack of succession planning, concerns over stuttering economic reform and private criticism of the Mubarak government's hard line toward domestic opponents.
But the cables also show that Washington sees Egypt as an important and -- until now -- stable ally on issues, including Iran's nuclear program, promoting negotiations between Israel and the Palestinian Authority and making life difficult for Hamas in Gaza.
And above all, Egypt is regarded as a moderate bulwark against Iranian-sponsored Islamist fundamentalism.
The cables show that Mubarak has taken a persistently hard line toward Iran, telling U.S. diplomats in 2008 that he had warned Tehran "not to provoke the Americans" on the nuclear issue and insisting Egypt could never accept a nuclear-armed Iran.
Mubarak has also repeatedly warned of Iran's influence with Hamas in Gaza and Hezbollah in Lebanon, and in a cable from February last year, was quoted as describing "Tehran's hand moving with ease throughout the region, from the Gulf to Morocco."
A 2009 cable noted that with "the discovery of a Hezbollah cell in Egypt, the Egyptians appear more willing to confront the Iranian surrogates and to work closely with Israel." To that end, the cables describe the Mubarak government as a helpful partner in stopping smuggling into Gaza from Egypt. A cable from 2008 quoted a senior Egyptian military figure as stating that Egypt had spent approximately $40 million to purchase the steel for an underground wall on the Gaza border, "and Egypt was paying the cost of this wall in terms of public opinion both within Egypt and the region."
There is no guarantee that any "successor" to the Mubarak government would take such a hard line with Hamas.
For the U.S., the alliance between Egypt and Saudi Arabia has also been an important counterweight to growing Iranian influence on the "Arab street" and among states such as Syria and Qatar.
Egyptian officials, from Mubarak down, have also repeatedly impressed upon visiting Americans -- military, diplomatic and Congressional -- that it alone among Arab states can play a mediating role between Israel and the Palestinians. [Egypt signed a peace treaty with Israel in 1979, and Mubarak has resisted popular opposition to it.]
Ahead of Mubarak's visit to Washington in May 2009, Ambassador Margaret Scobey wrote from Cairo that "the Egyptians want the visit to demonstrate that Egypt remains America's indispensable "Arab ally."
Scobey continued that Mubarak was "a tried and true realist, innately cautious and conservative, and has little time for idealistic goals."
He viewed himself as "someone who is tough but fair, who ensures the basic needs of his people."
At the same time, the Mubarak government has been very sensitive to any perceived slight from Washington. It has complained about cuts in U.S. economic aid and a stagnant level of military aid "because it shows our diminished view of the value of our relationship" according to one cable.
On pressure to improve human rights, according to one cable from Scobey in 2009, "Mubarak takes this issue personally, and it makes him seethe when we raise it, particularly in public."
In a later cable, she said that Mubarak "harkens back to the Shah of Iran: the U.S. encouraged him to accept reforms, only to watch the country fall into the hands of revolutionary religious extremists."
The Egyptian president relied on his interior minister and intelligence service to "keep the domestic beasts at bay, and Mubarak is not one to lose sleep over their tactics."
The U.S. cables display frustration with Mubarak's reluctance to address human rights issues, with one in 2008 saying: "While Egypt has made some limited gains over the last several years, such as on freedom of the press, progress overall has been slow."
In a later cable, Scobey suggested the new U.S. Secretary of State, Hillary Clinton "may wish to lay down a marker for a future discussion on democratization and human rights concerns." But given Mubarak's sensitivities, the U.S. has trodden carefully in pressing the Egyptian government on human rights. A cable from 2009 said the United States now avoided "the public confrontations that had become routine over the past several years" over human rights.
Over the past five years, the cables reveal a growing unease with the lack of a succession plan, and apprehension about the prospect of Mubarak's younger son, Gamal, taking over from his father. As far back as April 2006, one cable observed that Mubarak's wife, Suzanne, was their son's "most ardent booster" but added: "The possibility that Gamal might succeed his father remains deeply unpopular on the street."
It adds that "unlike his father, (Gamal) cannot take the military's support for granted," having never served as an officer. But the same cable laments the lack of obvious contenders to succeed the aging Mubarak -- a situation that appears to hold today.
Scobey wrote in apparent frustration two years ago that Mubarak "seems to be trusting to God and the ubiquitous military and civilian security services to ensure an orderly transition."
Recent events may have eroded that confidence, but one cable in 2007 pointed out that Egypt's internal security apparatus, "an estimated 1.4 million strong, is at least twice the size it was under Sadat ... and makes any kind of violent change of leader unlikely."
That perspective is now being challenged -- and the role of the military may be critical in deciding the outcome. A cable from 2008 cites Egyptian experts as describing a "disgruntled mid-level officer corps" with military salaries falling far behind the civilian sector and the top brass averse to Gamal succeeding his father.
Egyptian commentators also noted that many officers were frustrated that loyalty to the regime trumped competence, and that the best military talent was sidelined in case it should pose a threat to the government. Even so, one cable concludes: "The military still remains a potent political and economic force."
After discussing whether the military might step in to prevent Mubarak from passing the baton to his son, the cable concludes: "In a messier succession scenario, however, it becomes more difficult to predict the military's actions."