TRIPOLI (Reuters) - Several armed men attacked the headquarters of Libya’s National Oil Corporation (NOC) in the capital Tripoli on Monday, killing at least two staff members, a security official said.

In the first attack of its kind against the top managers of Libya’s state oil industry, two of the gunmen were also killed and at least 10 NOC staff wounded, officials said.

Security forces said they had regained control of the landmark glass-fronted building in the center of the city.

The attack came less than a week after a fragile truce halted fierce clashes between rival armed groups in Tripoli, the latest eruption of violence in Libya, which has been in turmoil since a 2011 uprising toppled Muammar Gaddafi.

Armed groups regularly block oilfields to make demands but the NOC headquarters had so far been spared the violence.

The NOC provides the vast bulk of Libya’s state income and, along with the Tripoli-based central bank, is one of the only state institutions still functioning well amid chaos.

No group immediately claimed responsibility for Monday’s attack. But the interior ministry said in a statement initial indications showed the gunmen belonged to Islamic State, which has previously carried out attacks in Tripoli and other Libyan towns and cities.

Slideshow ( 14 images )

Gunfire rang out in the morning as security forces allied to the Tripoli-based government arrived.

“The death toll so far is two killed from NOC staff and two attackers,” said Ahmad Ben Salim, spokesman for the Special Deterrence Force (Rada), one of the most powerful factions in Tripoli.

Security forces smashed windows so staff could escape and several people were hurt by shattered glass, witnesses said. NOC Chairman Mustafa Sanalla and his office manager were seen safely leaving the building.

OIL PRODUCTION

Libya has been divided between rival governments and military factions based in the east and west of the country since 2014, causing political deadlock and an economic crisis.

However, the NOC has continued to function relatively normally across Libya, which relies on oil exports for most of its income. Oil production has been hit by attacks on oil facilities and blockades, though last year it partially recovered to around one million barrels per day.

Islamist militants have sleeper cells in northern cities as well as mobile units in Libya’s southern desert, according to Libyan and Western officials.

In May, Islamic State claimed responsibility for a deadly attack on the national election commission offices in Tripoli. The group also claimed an attack in 2015 on the Corinthia hotel, a landmark location in Tripoli.

The NOC attack came a day after the United Nations said major armed factions had agreed to freeze their positions to extend the ceasefire.