Egypt's support for Al Bashir stems from fear of chaos in Sudan
Cairo's interests in Sudanese stability range from ensuring water supply to checking radical militancy
Sudanese leader Omar Al Bashir has not been the most reliable or trusted ally Egypt would like to see at the helm of its important southern neighbour.
But the prospect of a Sudan mired in lawlessness or becoming a haven for militants has left Cairo with little choice but to support the authoritarian Sudanese president while he clings to power as persistent street protests demand an end to his 29-year rule.
Anything less than an orderly and gradual transfer of power in Sudan could be catastrophic for Egypt, which is bound to its neighbour by a common history, extensive intermarriage, joint security and sharing of Nile water.
Mr Al Bashir has been in power since he led a military coup in 1989 but has failed to bring peace or economic prosperity to his vast country.
His campaign to crush a rebellion by ethnic Africans in the country's western Darfur region earned him an indictment for genocide from the International Criminal Court in 2010.
The following year the south of the country seceded, taking most of the country's oil wealth and ushering in one of the worst economic crises to hit Sudan since independence in 1956.
The latest bout of unrest began on December 19. The protests were initially against shortages and price rises, but they soon shifted to demands that Mr Al Bashir step down.
More than 50 people have been killed in the protests and hundreds wounded.
Authorities have arrested hundreds and Mr Al Bashir, in a bid to end the protests, declared a state of emergency last month, reshuffled his government and replaced provincial governors with military and security officers. The protests continued unabated.
Egypt at first patiently watched Sudan's unrest, but later appeared to throw its considerable weight behind Mr Al Bashir's government.
Publicly, that has been presented with Cairo's hallmark political parlance, speaking only of support for and interest in maintaining Sudan's stability and security.
Egypt's stakes in what happens in Sudan could hardly be higher.
Already, Cairo is struggling to contain the threat of militants in Libya, its neighbour to the west.
To the far east near the border with Gaza and Israel, Egypt is battling an insurgency by militants led by the extremist ISIS group.
To see Sudan turn into a springboard for cross-border attacks by militants against its troops or minority Christians would stretch Cairo's resources thin.
The Sudanese demonstrators want Mr Al Bashir replaced by a transitional government of technocrats who would organise free elections.
Such a government, analysts believe, would be too weak or preoccupied to prioritise issues of direct concern to Egypt.
Leading these is the giant Nile dam Ethiopia is building, which Cairo fears will reduce its vital share of the river's waters.
Egypt wants to have a say in the timeline for filling the large reservoir behind the dam to minimise the effects on its water share.
It needs Sudan, as the other downstream nation, to back it in any negotiations with Addis Ababa.
Mr Al Bashir is willing to do that, the analysts say, in exchange for any help he can get to ride out the crisis at home.
An ambitious project to link energy-starved Sudan to Egypt's electricity grid, which began before the unrest, has been completed, Egyptian state media reports.
Electricity from Egypt could ease the long and frequent power cuts that have fed popular discontent in Sudan.
Egypt is also putting to good use its close ties with Arabian Gulf states, hoping they will help to ease Sudan's economic crisis with cash or fuel shipments.
But it is not entirely clear whether Egypt sees Mr Al Bashir as a viable leader beyond 2020, when his second term expires.
He has already indefinitely postponed amending the constitution to allow him to run for a third term but he has not said he will step down.
Egypt recognises that Mr Al Bashir's rule has lost much of its political legitimacy. The Sudanese leader may realise that too.
"Everyone in the region with a stake in Sudan wants an organised transition over a reasonable period of time, with Al Bashir not running next year," said Hany Raslan, an Egyptian expert on Sudan.
"But Al Bashir also wants guarantees that he would not be handed over to the International Criminal Court to stand trial over Darfur.
"A great deal of diplomatic contacts is needed for this not to happen."
The longer Mr Al Bashir stays in office, the more time he has to further sideline the hardliners with whom he once allied himself, something that suits Egypt, which is averse to political Islam, and its regional allies.
The relatively small size and limited appeal of the demonstrations have also helped Mr Al Bashir cling to power.
The protests have so far been in the hundreds or low thousands, not large enough to persuade the army to intervene on the side of the protesters as it did during uprisings in 1964 and 1985.
"The current protests have become a war of attrition, with neither side willing to give up," Dame Rosalind Marsden wrote in an article published on Friday by London's Chatham House think tank.
But they have failed to include "powerful segments in Sudanese society that have a vested interest in sustaining the regime".
Updated: March 18, 2019 12:43 AM