Masked gunmen have attacked the headquarters of the Libyan National Oil Corporation in Tripoli, setting off explosions and exchanging gunfire with security guards and forces from Libya’s UN-backed government.

At least two NOC staff members were killed and 10 others injured. Two gunmen were also killed before security forces regained control of the building.

“Far more important than the considerable damage to our building is the human cost of such an attack. Our people are our most precious asset,” said the NOC chair, Mustafa Sanallah.

“This incident, however, serves to demonstrate the fragile security situation in our country and the need for additional measures to ensure NOC is able to withstand those that seek to halt Libya’s recovery,” added Sanallah, who is one of the country’s most influential non-political figures. He is credited with trying to root out corruption and increase Libyan oil production, which is likely to be the driving force behind any economic recovery.

The assault was thought to be the work of Islamic State, and not one of the feuding militias operating in Tripoli. The UN negotiated a ceasefire between militia groups three days ago after clashes left more than 60 people dead. It may have been that Isis seized on the recent lawlessness in the capital to mount Monday’s attack.

Security forces were seen smashing windows to help staff escape as smoke poured from the NOC building. A series of explosions were heard, suggesting bombs were being detonated inside. “The building was heavily damaged due to the fire. Smoke is everywhere,” Sanallah said. “The gunmen attacked the lower floors with random shooting and explosions. It’s a very violent attack.”

Isis attacked the high national election commission in May, but no group had yet claimed responsibility for the NOC attack. The incident will reinforce warnings given last week to the UN by the special ambassador, Ghassan Salamé, that Isis is staging a comeback in Libya. He suggested the country could become “a shelter for terrorist groups of all persuasions”.

Firefighters and onlookers gather in front of the NOC HQ after the siege. Photograph: Mahmud Turkia/AFP/Getty Images

The assault will do nothing to instil confidence in the Libyan oil industry among overseas investors, and shows how hard it may be to stage meaningful elections planned for December in the deeply divided country. France and Italy have been at loggerheads over the wisdom of holding the polls.

Last week, the NOC said it was on track for record revenues in 2018, with seven-month figures to July showing revenues had reached $13.6bn (£10.5bn). It predicted that without further disruption oil revenues could reach $23.4bn, which would be an 80% year-on-year increase and a fillip to the deeply indebted government. The NOC reached a peak production level of 1.3bn barrels a day in February.

After announcing the figures, Sanallah again called for an end to corruption and a fair distribution of oil revenues across the country, where two rival governments and armed groups are vying for control.

“I have repeatedly demanded the fair distribution of national oil revenues and called for transparency across government in this regard,” Sanallah said. “This is one of the most important issues facing our country. NOC will ensure it is the governance benchmark against which other Libyan institutions will measure their performance.”

The country’s oil sector has been repeatedly disrupted by violence since a 2011 Nato-backed rebellion that toppled Muammar Gaddafi. Petrochemical exports had accounted for the vast majority of state revenues under his rule, with production at 1.6m barrels a day. Since Gaddafi’s ousting, output fell to about 20% of that level, before recovering to more than 1m barrels a day by the end of 2017. Opec, the oil producers cartel, has estimated Libya’s oil reserves at 48bn barrels, the largest in Africa.