Peace talks between rival Libyan political factions appeared to be on the verge of collapse as fighting for control of the capital raged on for a second day.

Libya's UN-recognised government in Tobruk conducted air strikes on Saturday against airports and a military camp in the capital Tripoli, controlled by a rival government, and killed a senior commander loyal to that government, officials said.

The Tobruk-based government said on Friday that forces linked to General Khalifa Haftar had launched the military offensive to "liberate" Tripoli, which is governed by a rival legally-installed administration known as the General National Congress (GNC).

Prime Minister Abdullah al-Thinni's government, which has allied itself with Haftar, was forced to relocate to the eastern city of Tobruk last year after the Libya Dawn seized Tripoli.

Libya has been wracked by violence since the NATO-backed uprising toppled longtime ruler Muammar Gaddafi in 2011, with the rival administrations and their allied militias battling for power.

Airstrikes on the capital

Amid the ongoing battle for Tripoli, UN-brokered peace talks continued between officials from the rival administrations for a second day in Morocco's capital Rabat on Saturday - aiming to reach agreement on the formation of a national unity government.

UN special envoy Bernardino Leon, however, said reaching an agreement was "going to be difficult", given the new clashes in and around Tripoli.

"[On Friday] we had a new military operation against Tripoli precisely during decisive moments of the talks and our reaction today is as strong as it was in the past," Leon told reporters on Saturday.

"Military activities undermine the situation in Libya and prevent the unity of the Libyans fighting terrorism. This operation we condemn in the strongest possible terms because it's undermining dialogue."

Sources told Al Jazeera that air strikes had been carried out in and around the capital on Saturday, including the airport, but the offensive had so far been repelled.

Residents told the Reuters news agency that the capital was quiet, but television stations linked to the opposing sides gave conflicting accounts of who was in control of two towns west of Tripoli.

RELATED: The rise and rise of Libya's rogue general

The Libya Dawn militia, which backs the GNC, said it had clashed with a group of gunmen who infiltrated Aziziya, a town 35km south of the capital, and captured a number of them.

Al Jazeera's Hashem Ahelbarra, reporting from Rabat where the peace talks are taking place, said that the international community warned the rival governments that "whoever is held responsible for undermining the political process by launching more attacks in Libya is going to be targeted by UN sanctions".

"The international community is using the sanctions threat because it is concerned that the instability in Libya will just deepen the political divide," said our correspondent.

"This is something that plays into the hands of groups affililated with ISIL [the Islamic State of Iraq and the Levant] who are taking advantage of the instability by further expanding into the eastern part of the country."

RELATED: What is not being discussed about Libya

The United States and five European allies issued a joint statement on Sunday condemning the violence by both sides and urging an end to the fighting. They welcomed resumption of the talks in Morocco and called for "good faith" efforts to reach a ceasefire and agree on a unity government.

Peace talks have dragged on for months in different venues but with little results as fighting continues to escalate.

Haftar, a Gaddafi-era general who defected in the 1980s, has previously condemned the peace talks as discussions with "terrorists".

Since Gaddafi was overthrown and killed, the country has grown increasingly polarised as former rebel brigades clash over how to govern Libya and share its oil wealth.

Meanwhile, authorities in Morocco said they dismantled a terrorist cell plotting to carry out terrorist acts in the country.

In a statement obtained by Al Jazeera, authorities said that arrests were made in different cities with weapons and ammunition being confiscated.