At least 30 people have been killed and 33 others wounded in an attack on a military academy in the Libyan capital, the health ministry of the Tripoli-based government said.

At the time of Saturday's attack, cadets were gathered on a parade ground before going to their dormitories, according to Amin al-Hashemi, spokesman for the health ministry of the United Nations-recognised Government of National Accord (GNA).

More:

Reporting from Tripoli, Al Jazeera's Mahmoud Abdelwahed said the situation in the capital's hospitals was "chaotic" following the attack.

"Medical sources [at public hospitals] said it was very difficult for them to identify the bodies of the victims because most of them were either burned or torn apart by the attack."

Abdelwahed said the majority of the victims were military students from cities across Libya, aged between 18 and 22.

Since April, the Tripoli-based GNA has been facing an offensive by renegade military commander Khalifa Haftar's self-styled Libyan National Army (LNA), which is aligned with a rival government based in the country's east.

There has been an increase in air raids and shelling around Tripoli in recent weeks, with fears that fighting could escalate further after Turkey's parliament voted to allow a troop deployment in support of the GNA.

Forces allied with the GNA described Saturday's attack on the military camp at Al-Hadhba as "an aerial bombing" launched by their eastern rivals. An LNA spokesman denied involvement.

GNA Health Minister Hamid bin Omar told Reuters news agency that the number of dead and wounded was still rising. Tripoli ambulance service spokesman Osama Ali said some body parts could not be immediately counted by forensic experts.

The GNA health ministry called for blood donors to go to hospitals and blood banks to help those injured.

Separately, the GNA foreign ministry called for referring Haftar and his aides to the International Criminal Court on charges of committing "crimes against humanity", adding that it would call for an emergency UN Security Council meeting to discuss the alleged crimes.

The UN Support Mission in Libya (UNSMIL) also condemned the attack, saying that "rising escalation ... further complicates the situation in Libya and threatens the chances of returning to the political process".

Libya was plunged into chaos after the toppling and killing of Muammar Gaddafi in a 2011 NATO-backed uprising.

Increase in attacks

An increase in air attacks and shelling in and around Tripoli has caused the deaths of at least 11 civilians since early December and shut down health facilities and schools, the UN mission in Libya said on Friday.

Rockets and shelling also shut down Tripoli's only functioning airport on Friday.

The southern part of Tripoli has seen fierce fighting since last April, the start of Haftar's offensive against the GNA.

Haftar's forces are backed by Egypt and the United Arab Emirates, while Russian military contractors have also been deployed with the LNA for several months, diplomats and analysts say.

Turkey, which backs the GNA, signed security and maritime agreements with the Tripoli-based government in November.

The Turkish parliament last week approved a bill to deploy troops in support of the GNA, paving the way for increased military cooperation despite criticism from opposition legislators.

Days after the vote, Saudi Arabia condemned "the recent Turkish escalation in Libya".

The foreign ministry said, in a statement on the state news agency SPA, it considered the move a violation of UN Security Council decisions.

"The kingdom affirms that this Turkish escalation poses a threat to the security and stability in Libya and a threat to Arab and regional security, as it is an interference in the internal affairs of an Arab country in flagrant violation of international principles and covenants," it said.

The Arab League has warned that foreign military interference in Libya will facilitate the arrival of foreign fighters into the war-torn country.

More than 280 civilians and more than 2,000 fighters have been killed since the start of Haftar's assault on Tripoli, according to the UN. The fighting has also displaced some 146,000 people.