BEIRUT (Reuters) - A militant attacked a security patrol in Lebanon’s northern city of Tripoli on Monday night, killing two police officers and two soldiers before blowing himself up, officials said.

Slideshow ( 4 images )

Interior Minister Raya al-Hassan described it as a “lone wolf attack”, though authorities canceled Eid al-Fitr celebrations in the coastal city on Tuesday and promised to secure it.

Major attacks had dropped off in Lebanon since a wave of militant bombings - many of them linked to the war in neighboring Syria - struck parts of the country from 2013 to 2016.

The gunman threw a bomb at security forces in a government building and opened fire on a patrol, two security sources told Reuters. The attacker had earlier been in jail on charges of belonging to Islamic State, one of the sources said.

The militant then detonated an explosive belt after soldiers raided a residential building where he was holed up, the army said.

Lebanese Prime Minister Saad al-Hariri gave his condolences to the families of the dead and said all measures must be taken to protect Tripoli and “weed out any remnants of terrorism”.

Interior Minister Raya al-Hassan, described the attack as “a new form of terrorism”.

“Can I tell you we can curb it 100%? We can’t curb it. Countries that are perhaps more advanced than us have not been able to,” she told a press conference.

The head of Lebanon’s Internal Security Forces, accompanying her, said the agency constantly keeps tabs on suspects and sleeper cells.

“But when someone reaches a level of desperation in some cases, and carries out a crazy action, this leads us to not know about him (ahead of time),” General Imad Othman told reporters.

Othman said the man had been in prison for a year and a month before being released, without giving further details.