Lebanon's interior minister says a gunman was working alone when he went on a shooting spree that killed four security personnel in the northern city of Tripoli.

Minister Raya El Hassan says the shooting by the man identified as a former member of the Islamic State group, Abdul-Rahman Mabsout, is an "individual case" and the situation is under control.

She spoke to reporters in Tripoli Tuesday, hours after Mabsout, riding a motorcycle, opened fire on police and army vehicles in the city, killing two police officers and two soldiers before breaking into a residential building and hiding there. He later detonated an explosive belt when confronted by troops.

The rare shooting, which began late Monday, shook the predominantly Sunni Muslim coastal city on the eve of the Eid al-Fitr holiday.