The Brega refinery, on Libya's Gulf of Sidra, where the tanker known as Morning Glory was illegally loaded with oil, on March 11, 2014. Abdullah Doma/AFP/Getty Images

Libyan rebels occupying oil ports clashed with troops Saturday when they attacked an army base, wounding 16 people before tribal leaders brokered an end to the fighting, local residents and a state news agency said.

Anti-aircraft gunfire and explosions were heard late at night and again after dawn Saturday in Ajdabiya, the hometown of rebel leader Ibrahim Jathran, whose fighters seized three ports in the summer to demand a greater share in Libya's oil wealth.

LANA state news agency said tribal community leaders helped stop the fighting later Saturday between the rebels and Libyan soldiers, who were preparing for a possible military offensive to break the blockade that has slashed vital oil exports.

But the agency reported 16 people were wounded in the violence.

The clashes broke out just hours before the return to Libya of an oil tanker seized last Sunday by U.S. commandos in the Mediterranean after it had loaded crude at one of the ports Jathran's men have occupied.

The Morning Glory, once a North Korean-flagged vessel reportedly owned by Egypt, arrived Saturday in Libya under U.S. Navy escort at Zawiya, one of the country's key ports under government control. The U.S. embassy later confirmed to AFP that the handover to Libyan control went smoothly.

The struggle for control of Libya's vital petroleum resources is one of the challenges facing the weak central government, which has been unable to secure the North African country three years after the fall of Muammar Gadhafi.

Brigades of former anti-Gadhafi rebels and militias refuse to disarm and often use armed force or control over oil facilities to make demands on a state whose national army is still in training.

Tripoli's central government gave Jathran a two-week deadline on March 12 to end his port blockade or face a military assault, though analysts say Libya's nascent armed forces may struggle to carry out that threat.

Jathran's self-declared Cyrenaica government is demanding more autonomy for his eastern region and a share of oil revenues. Attempts to broker a deal between the federalists and the central government have so far failed.