Fed up with the ways of Sudan's elected government, Egypt warmly welcomed Omar Al Bashir's military coup nearly 30 years ago, declaring within hours its strong support for the new order. What Egypt did not know then was that Mr Al Bashir, at the time an army brigadier general, was an Islamist backed by other Islamists who were even more hardline than him. It took weeks to realise what was really going on, and by then it was too late for Cairo to save the embarrassment of what is widely seen as one of its biggest foreign policy blunders and intelligence failures. Mr Al Bashir was overthrown by the army last week after 29 years in power defined by failure, from a battered economy and an international indictment against him for genocide to the loss of about a third of his country's territory and a grim human rights record that turned Sudan into something of a pariah state. The former president has been replaced by a military council that says it will rule for two years before elections are held. The protesters who have been demonstrating on the streets to demand Mr Al Bashir's resignation since December have rejected the coup and are insisting that a transitional civilian government take office. Coverage of the dramatic events in Sudan have dominated the radio, television and press in Egypt, but with little commentary or analysis. Officially, Egypt fully supports "the choices of the brotherly people of Sudan and their free will" to chart the country's future, according to a foreign ministry statement on April 11. "Egypt expresses its full confidence in the ability of the brotherly people of Sudan and their loyal and patriotic army to pull through this decisive phase and its challenges," it said. Non-committal and ostensibly neutral, the statement likely conceals Cairo's alarm over the events in Sudan, a southern neighbour that Egypt has traditionally viewed as its strategic depth and which it has, to the annoyance of many in Khartoum, always treated as something of a younger brother. "Bashir was not a friend of Egypt and the Egyptians will not shed a tear over him," said Michael W Hanna, an Egypt expert at New York's Century Foundation. "But they must be worried about all that is going on in Sudan. It is not that Egypt feels what is going on there is contagious, but it fears the end result there might not be in synch with what it wants." The tumult in Sudan is playing out at a bad time for Egypt, with its protege in Libya, its troubled and splintered neighbour to the west, compounding his country's woes by seeking to capture the capital Tripoli and bring the downfall of the UN-backed government there. Egypt has supported Khalifa Haftar and his self-declared Libyan National Army in their drive against Islamist militants in the east and south of the vast, oil-rich nation, a stance dictated by the threat to its security posed by the extremists across its western border. However, there is no evidence to suggest that it supports or had prior knowledge of Field Marshal Haftar's march on Tripoli, which has wrecked efforts to reunite and stabilise Libya. Similarly, Egypt's main interest in Sudan is to see that the vast and ethnically and religiously diverse country does not plunge into chaos, allowing militants to set up shop and stage cross-border attacks against its security forces just as those in Libya have done. Analysts have said since the start of the unrest in Sudan nearly four months ago that Egypt wanted Mr Al Bashir to survive long enough for it to influence the process of change to avert the kind of chaos prevailing in Libya and prevent hardcore Islamists from taking over. To this end, Egypt repeatedly declared support for the Khartoum government and sought to reduce pressure on Mr Al Bashir through steps to ease the economic hardships suffered by his people. For example, it accelerated the linking of its electricity grid with Sudan's to reduce power outages, sent in mobile bakeries to increase bread production and offered medical aid. Just as importantly, it has lobbied Gulf Arab nations to extend emergency financial support to Sudan. The show of support, however, belied Cairo's conviction that Mr Al Bashir's rule had exceeded its expiry date and that, at the end, he was never a reliable ally. In recent years, Mr Al Bashir gave Cairo reason for concern by forging close ties with its rivals, Qatar and Turkey. Before that, he was close to Iran, much to the alarm of Cairo and its Gulf Arab allies. Moreover, he accused Cairo of aiding rebels and reignited a long-standing dispute with Egypt over a strategic border strip on the Red Sea. Egypt has tried hard not to lose Mr Al Bashir to rivals with deep pockets like Qatar or with regional ambitions like Turkey. It restrained itself in the face of hostile Sudanese media campaigns, a vengeful ban on the import of Egyptian farm produce and the withdrawal of Khartoum's ambassador from Cairo. More broadly, it cast aside its entrenched opposition to the political Islam Mr Al Bashir's government represented and sought to persuade him to drop some of his more provocative foreign policy choices. On its part, Egypt cracked down on Sudanese dissidents living in exile in Egypt and even banned one of the country's best known and most seasoned politicians, former prime minister and opposition leader Sadeq Al Mahdi, from entering the country. Going to such lengths to appease Mr Al Bashir was partly to secure his support in a dispute with Ethiopia over a massive dam Addis Ababa is building on the Nile which Egypt fears might reduce its share of the river's water. Now Egypt must wait and see how the turmoil in Khartoum plays out before it formulates a new strategy. "Egypt knew it was helping a collapsing regime," said Sudan expert Hany Raslan from the Al Ahram Centre for Political and Strategic Studies. "But the importance of Sudan to its national security could not be overestimated."