Lebanese security forces search Muslims arriving to perform Eid Al Fitr at a mosque in downtown Beirut. Anwar Amro/AFP
A lone gunman killed four members of the security forces in Lebanon's northern city of Tripoli overnight before blowing himself up, officials said on Tuesday.
"The shooting spree resulted in the deaths of two members of the Lebanese army and two members of the internal security forces," a security official told AFP.
The army confirmed it had lost two of its men and the national news agency confirmed the overall toll of four.
There was no immediate claim for the shooting and the gunman's motives were unclear but two security officials at one of the scenes of the attack told AFP that he was a militant recently released from prison.
The gunman sowed panic in the streets late Monday, as Lebanon's second city prepared for the first day of Eid Al Fitr, the feast marking the end of the Muslim fasting month of Ramadan.
He first opened fire on a branch of the central bank, a security official said.
A large number of security force personnel were deployed and the gunman also opened fire on a police station and on a military vehicle in the ensuing manhunt.
The attacker was eventually cornered in a residential building and killed himself by detonating an explosives vest he was wearing.
Lebanon, including Tripoli and areas around it, was affected by a spillover of violence from the conflict in neighbouring Syria but the security situation has been quiet in recent years.