Several armed men attacked the headquarters of the National Oil Corp. (NOC) in the Libyan capital Monday and several blasts could be heard, a witness said.

Gunfire could be heard as a security force allied to the Tripoli-based government arrived at the landmark building located in the center of the Libyan capital.

"Three or five gunmen were shooting inside the building," an NOC staff member said after he said he had jumped out of a window to flee. "Several people were shot."

No claim of responsibility for the attack was immediately made as firefighters and ambulances arrived to treat wounded streaming out of the building.

The NOC building is covered mainly in glass, and a witness said several people had been wounded by shattered windows.

Security forces were smashing windows so staff could escape, witnesses said.

Smoke could be seen rising as security forces took up positions around the offices in central Tripoli and surrounding roads were cordoned off.

A witness saw ambulances leaving the site. A staff member from a hotel next to the NOC offices said he had heard about five blasts.

Tripoli was shaken by clashes between rival armed groups at the beginning of this month but the capital has also seen occasional militant attacks.

In May, the Islamic State group claimed a deadly attack on the national election commission offices in Tripoli.

The group had also claimed an attack in 2015 on the Corinthia hotel, a landmark location in Tripoli.