Updated

A lone gunman using a motorcycle fired on police and army vehicles in different parts of the northern city of Tripoli, killing two police officers and a soldier and wounding several others Monday night before blowing himself up later when confronted by troops, Lebanon's army and the state-run National News Agency said.

Troops were deployed in areas of the city to search for the attacker, who was tracked down to an apartment, the army said. It said members of an elite military intelligence force stormed the apartment early Tuesday and opened fire at the suspect, who then set off an explosive belt he was wearing.

"The operation is over," an army officer told local LBC television. Troops and plainclothes security agents surrounded the area and prevented anyone from entering the building.

There was no claim of responsibility for the attack.

The army identified the gunman as Abdul-Rahman Mabsout, but gave no other details. LBC said Mabsout was a former member of the Islamic State group who fought with the extremist movement in Syria. It said he had been detained when he returned to Lebanon in 2016 and was released a year later.

The attack occurred on the eve of Eid el-Fitr, the feast that marks the end of the Muslim holy month of Ramadan of fasting. The Lebanese army announced earlier that it has increased security around the country because of Eid el-Fitr, when people go out to celebrate.

The military statement said the shooter first fired at a branch of the Lebanese Central Bank, then shot at police and later at an army vehicle. It said one soldier was killed and two others wounded in the shooting at the army vehicle.

The state news agency said a police officer died on the spot and another died of his wounds in a hospital later. It said another officer was wounded.

Tripoli, which is Lebanon's second largest city, has seen in the past clashes between rival groups that support or oppose the Syrian government of President Bashar Assad. The city is also home to some extremists who fought against the Lebanese army in the past.

The Islamic State group and al-Qaida-linked militants have claimed responsibility over the past years for attacks in different parts of Lebanon that killed dozens of people. Such attacks have been rare recently.