* IMF deal may lift confidence, allow controlled devaluation

* But many economic risks would remain in Egypt

* Dubai's Emaar Properties retreats from chart barrier again

* Saudi's National Commercial Bank falls on dividend cut

* But retailer Alhokair surges on Q2 earnings beat

By Andrew Torchia

DUBAI, July 27 (Reuters) - Egyptian stocks surged on Wednesday on news that Cairo was close to agreeing an International Monetary Fund (IMF) lending programme, while weak oil prices pulled down most bourses in the Gulf.

The main Egyptian equities index climbed 5.0 percent to 7,915 points, its biggest daily gain since mid-March, in the market's heaviest trade since mid-April.

Blue chips favoured by foreign investors outperformed with Commercial International Bank, the largest listed lender, jumping 5.7 percent and Global Telecom up 6.1 percent.

Financial firm EFG Hermes , which could benefit from handling an inflow of foreign investment if the IMF loan stabilises Egypt's struggling balance of payments, rocketed 10.7 percent.

Ibrahim al-Nimr, head of technical analysis at Cairo's Naeem Holding, predicted the index would break above 8,000 points when the signing of the IMF loan became certain.

"This may in turn prompt some profit-taking at those levels, but even then we expect certain sectors to continue riding the bull wave, especially banks and real estate."

The government said it was seeking $7 billion annually from the IMF over three years. Prime Minister Sherif Ismail ordered the central bank governor and minister of finance to complete negotiations for the programme with an IMF team that would visit Egypt in the next few days.

An IMF deal, and attached economic policy conditions, could help to revive foreign investor confidence in Egypt and allow it to remove some of the curbs on access to hard currency that have plagued the economy.

Some fund managers think an IMF deal in August or September - and possibly an interest rate hike at a central bank meeting this Thursday - could create conditions allowing authorities to engineer a controlled devaluation that would bring the Egyptian pound to levels which reignited fund inflows into the country.

But there are many risks. An initial devaluation in March this year failed to spur fund inflows, and $21 billion over three years would probably not be enough by itself to repair Egypt's balance of payments, especially if Gulf donors decide to cut their aid in response to their own budget pressures.

Also, the IMF programme could involve fiscal tightening that would prevent any quick recovery in economic growth.

"We believe foreign investors should stay underweight on Egypt until the extent of devaluation is clear," said EFG Hermes. "Cyclical stocks are likely to remain under pressure as domestic demand - already under pressure for the past 18 months - will be squeezed in the first phase of any IMF programme."



GULF

In the Gulf, Dubai's index fell 0.9 percent in a broad-based decline. Emaar Properties lost 0.3 percent to 6.88 dirhams; since last week it has been unsuccessfully testing chart resistance on its October peak of 7.01 dirhams.

Logistics company Aramex rose 1.3 percent after jumping 5.5 percent on Tuesday. After the close on Tuesday, Bloomberg reported, citing unnamed sources, that founder Fadi Ghandour had sold his entire 9.9 percent stake in the firm to Gulf investors including Emaar chairman Mohamed Alabbar. Dubai exchange data on Wednesday showed no such ownership change.

In Saudi Arabia, the index fell 0.6 percent as National Commercial Bank lost 2.9 percent after its board recommended a cash dividend of 0.60 riyal per share for the first half, down from 0.80 riyal a year earlier.

Low-cost retailer Abdullah Al Othaim dropped 1.5 percent after posting a 9.6 percent drop in quarterly profit, citing higher personnel and promotional expenses as well as rises in transport and electricity costs due to austerity measures in the 2016 state budget.

But petrochemical giant Saudi Basic Industries gained 1.8 percent before the release of its second-quarter earnings, expected after the close.

Retailer Fawaz Abdulaziz Alhokair Co gained 2.6 percent after reporting a 0.9 percent year-on-year rise in quarterly profit to 212.6 million riyals ($56.7 million). It cited the contribution of new stores and demand during the holy month of Ramadan. EFG Hermes had forecast 170.1 million riyals and NCB Capital 190.0 million.

Qatar's index rose 0.6 percent as Qatar Islamic Bank , which beat forecasts with its second-quarter earnings last week, surged 2.9 percent in the market's heaviest trade.



WEDNESDAY'S HIGHLIGHTS



SAUDI

* The index dropped 0.6 percent to 6,432 points.



EGYPT

* The index jumped 5.0 percent to 7,915 points.



DUBAI

* The index fell 0.9 percent to 3,510 points.



ABU DHABI

* The index edged up 0.1 percent to 4,597 points.



QATAR

* The indexrose 0.6 percent to 10,605 points.



KUWAIT

* The index fell 0.4 percent to 5,462 points.



OMAN

* The index edged up 0.2 percent to 5,822 points.



BAHRAIN

* The index edged down 0.2 percent to 1,158 points. (Additional reporting by Celine Aswad in Dubai; Editing by Mark Potter) ((andrew.torchia@thomsonreuters.com; +9715 6681 7277; Reuters Messaging: andrew.torchia.thomsonreuters.com@reuters.net))