* Three local lenders fail liquidity test
* Foreign direct investment falls 29 pct in H1
* Economic outlook dwarfed by 2019 election fears (Adds details of banks' liquidity tests)
By Chijioke Ohuocha
LAGOS, Nov 2 (Reuters) - HSBC and UBS have closed their offices in Nigeria, the country's central bank said in a report on Friday as it revealed foreign investment had fallen sharply from a year ago.
The bank said foreign direct investment in Nigeria fell to 379.84 billion naira ($1.2 billion) in the first half of the year from 532.63 billion naira ($1.7 billion) a year earlier.
It did not given reasons for the bank closures.
HSBC was not available to comment and UBS declined to comment.
The central bank said the outlook for the Nigerian economy in the second half was "optimistic" given higher oil prices and production but rising foreign debt and uncertainty surrounding the 2019 presidential election was a drawback.
Investor confidence in the West African country has been shaken since the central bank in August ordered MTN to bring back $8.1 billion to the country, part of profits which the South African telecoms firm sent abroad.
An HSBC research note dated July 18 said a second Buhari term "raises the risk of limited economic progress and further fiscal deterioration, prolonging the stagnation of his first term, particularly if there is no move towards completing reform of the exchange rate system or fiscal adjustments that diversify government revenues away from oil."
The central bank also said three lenders failed to meet its minimum liquidity ratio of 30 percent, without naming them.
It added that non-performing loans (NPLs) have dropped to 12.4 percent as at June 2018 from 15 percent a year ago, still a long way above its 5 percent threshold.
"To further consolidate on the improvement, the Central Bank of Nigeria directed banks to intensify efforts at debt recovery, realisation of collateral for lost facilities and strengthening their risk management processes," it said in the report.
In September, the regulator withdrew the license of Skye Bank for failing to recapitalise. It then transferred Skye's assets to a "bridge bank" Polaris wholly-owned by the state-backed asset management company AMCON.
Nigerian banks have been trying to raise fresh capital after huge loan losses worsened by an economy that has just emerged from a recession.
Diamond Bank last week denied it was in talks with investors to raise cash but said it was managing its capital, which borders on the regulatory minimum, to grow.
Another lender Unity Bank has been seeking to raise fresh funds to recapitalise. ($1 = 305.5500 naira) (Reporting by Chijioke Ohuocha Editing by Raissa Kasolowsky and Elaine Hardcastle)