Bank guards shot dead three people as they tried to disperse a crowd of hundreds of people lining up for cash outside a bank in the Libyan capital Tripoli on Wednesday, a security official said.

Libyan banks have been suffering from severe liquidity problems, which bankers say is partly caused by people withdrawing cash and keeping it at home due to concerns over security.

For months, long lines have formed daily outside banks across the country, and in some cases people have begun lining up overnight.

Banks have placed limits on withdrawals, with residents in the capital currently restricted to taking out a maximum of 200 Libyan dinars at a time. That is the equivalent of about $145 at the official exchange rate, but just $50 at black market rates.

Wednesday's shooting happened outside the North Africa Bank in Tripoli's Qaser Bin Ghasir neighborhood, said Salah Eddin Al-Marghani, a security official for southern Tripoli.

"One of six members of security team securing the bank shot in the air when there was a stampede among the crowd, but mistakenly hit the building and then the people," he said.

The guards had been placed under investigation, Marghani said.

Libya's economy has been severely damaged due to political strife and conflict following the uprising against Moammar Gadhafi in 2011.

The country is largely dependent on oil revenues, but these have slumped as prices have fallen and labor disputes, factional rivalries and militant attacks have slashed production.