TRIPOLI A country still rebuilding from civil war and prowled by loosely-governed bands of idle and heavily armed youths, Libya might seem an unlikely donor to bail out its bigger neighbour Egypt.
But by quietly finding $2 billion (1.3 billion pounds) of its oil-derived wealth to deposit in the Egyptian central bank, Libya is stepping back into its old role as North Africa's answer to the Gulf petro-states, discreetly deploying its cash to secure its interests.
First and foremost, Tripoli says it aims to protect itself from the spread of Egyptian unrest should its much larger and poorer neighbour teeter. It also wants to persuade Cairo to hand over fugitive allies of Muammar Gaddafi. And in the longer run, it could be using its generosity now to open doors for future investments in the region as its oil money rolls in.
So far little information has been given about the terms of the deal, with Libyan officials perhaps being cagey about the details to avoid drawing too much attention at home to their generosity abroad.
But the payment demonstrates the shifting fortunes of the North African neighbours two years after the regional revolts that toppled their long-serving autocrats, Libya's Gaddafi and Egypt's Hosni Mubarak.
Libya's central bank governor, Saddeq Omar Elkaber, confirmed the deposit at the weekend, saying Egyptian stability was important to Tripoli and comparing the move to Greece's bailout by its European partners.
"There are times when your upstairs neighbour has a leaking pipe and you need to help him fix it for your own peace of mind," deputy central bank governor Ali Salem Hibri said.
"This deposit could be considered as a form of support for economic stability. The stability of neighbouring countries is important to us, especially Egypt."
Libya, still prone to political unrest and bristling with guns looted from Gaddafi's arsenals during its civil war, has nevertheless nearly restored pre-war oil output that makes it one of the richest countries per capita in the region.
Egypt has no such source of wealth and has been rapidly burning through the hard currency reserves it needs to import food to feed its 82 million people. It is grappling with falling tourism, a soaring budget deficit and an atmosphere of political confrontation that has led to waves of violent street protests.
The two countries share a border of more than 1,000 kms (620 miles), and are important trading partners for goods and migrant workers. Libyan officials fear that any worsening of Egypt's economic crisis could spread unrest across the frontier.
The announcement of the deposit also comes after months of pleas from Libya's new rulers for Cairo to extradite former Gaddafi allies who fled across the border during the fighting, now wanted for trial in Tripoli.
In March, Egyptian police arrested Gaddafi's cousin Ahmed Gaddaf Alddam, a former envoy to Cairo. Last week Prime Minister Ali Zeidan said Libya was appealing an Egyptian court decision barring his extradition, which said he should be tried in Egypt.
Two other ex-Gaddafi officials were sent to Libya last month but Gaddaf Alddam, 60, was not handed over partly because he claims Egyptian citizenship, according to his lawyers.
He is wanted in Libya for alleged counterfeiting, forgery, fraud and money laundering, and is also under investigation on suspicion of attacking Egyptian police during his arrest.
"The deposit can be seen as a form of urgent support for a country in critical condition as any instability could quickly spread across the border," a Western diplomatic source said.
"But it can also be seen as an attempt to sweeten conditions for Egypt to extradite supporters of the former regime."
Libya's new rulers have not been shy about using oil funds for their neighbours. They authorised a payment of almost $200 million to Mauritania after it extradited Gaddafi's former spy chief Abdullah al-Senussi last year, although they later denied there was a quid pro quo.
Libya has already said it plans to refine some of its crude oil in Egyptian refineries to help Cairo.
However, authorities appear keen to play down the $2 billion payment to Egypt at a time when Libya faces its own challenges: reconstruction costs estimated at $200 billion and unemployment around 15 percent.
Tripoli is now spending much of its oil income on state salaries, including payments to former rebel fighters. Such payments buy the loyalty of a generation of heavily armed young men but have made it hard to disarm them.
Libya's shabby towns and its need for reconstruction belie just how rich it is. Bringing oil output back close to its 1.6 million barrel-per-day pre-war level allowed it to record economic growth of more than 100 percent last year, according to the International Monetary Fund.
The central bank's foreign reserves, including cash and liquid instruments, total around $160 billion - giving it more than ten times as much cash on hand as Egypt, despite having less than a tenth the population.
"Egypt is worse off than Libya and needs assistance," Ahmed al-Awjali, economics professor at Benghazi University, said. "Two billion dollars is not much compared to the assets Libya has abroad."
Details about the $2 billion deposit for Egypt are scarce. Last week, Egyptian state news agency MENA reported Libya would give Egypt a $2 billion five-year interest-free loan, however both Elkaber and Zeidan denied a loan was made.
On Saturday, Elkaber told Reuters and another international news agency the amount was taken from Libyan investments in Egypt such as banking, property and agriculture. However a central bank statement denied the deposit was taken from those investments, estimated at "tens of billions of dollars".
It said it can be withdrawn after five years, aims to help boost economic recovery and stem the flow of illegal workers.
Elkaber, travelling abroad, could not be reached for comment. Other banking and finance ministry officials said they had little information about the deposit. Zeidan said the central bank "was free to make deposits where it chose".
"If this can help secure Egyptian stability this can only be beneficial for us," a member of Libya's national assembly said.
So far domestic reaction has been muted but some say the matter should have been brought before the ruling congress.
"The government has not given details," Libyan political analyst Azzedine Aguil said. "If Libya is doing this for the handover of Gaddafi allies, it is doing so discreetly."
And Libya may also be looking further ahead. Officials have said Libya's sovereign wealth fund, with assets of $60 billion, would continue to look for investment opportunities in Egypt.
"Tripoli may want to reinforce its relationship with Cairo at a time when Egypt is very vulnerable," Anthony Skinner, head of risk analysts Maplecroft's MENA practice, said.
"The Libyan authorities could in future remind the Egyptian authorities that they provided a prop to the economy during a period of great need ... and may seek to refer to this in order to be able secure new contracts, joint projects and exploit the Egyptian market in the future."
(Additional reporting by Ali Shuaib; Writing by Marie-Louise Gumuchian; Editing by Peter Graff)
Our top photos from the last 24 hours.