The ousting of Libya's prime minister, who fled to Europe this week, has triggered fighting between eastern and western regions that threatens to divide the country.

Ali Zeidan, a popular figure with western diplomats, was sacked by the Islamist-led congress on Tuesday after failing to prevent a North Korean tanker loading oil from a port controlled by rebels in the eastern region of Cyrenaica.

Fearing arrest following his dismissal, Zeidan made a late-night escape from Tripoli aboard a private jet, leaving behind a fractured government and a country in turmoil, fighting over its rich oil resources.

Libya has Africa's largest oil reserves, but production has plummeted since the summer, when a self-declared federalist government was formed in Cyrenaica, which blockaded key oil terminals.

The rebels' argument is that much of Libya's oil is produced in the east but the revenue flows to Tripoli in the west; they have demanded a larger share of the income in return for lifting the blockade.

Oil revenue is almost the only source of income for a country that – three years after Muammar Gaddafi was toppled in the Nato-backed Arab spring revolution – is characterised by militia violence, a moribund economy and pockets of Islamist radicalism.

The day after Zeidan's removal, the powerful Misrata militia, allied to congress, launched an offensive to retake the blockaded oil terminals, storming the base of an army special forces unit – the Zawiya Martyrs brigade – in the central city of Sirte, leaving five people dead.

Within hours, federalist militias, backed by some units from Libya's small regular army, had set up a defence line at the Red Wadi, a natural feature that blocks the way to the oil ports.

The congress leader and de facto president, Nuri Abu Sahmain, quickly denounced the rebels as lawbreakers and set a two-week deadline for them to clear the ports or face attack by Misratan forces.

This produced an equally fiery response from the federalists. "Baqua forces are fighting alongside Zawiya Martyrs," said spokesman Senussi El-Megrabi, using the Arabic name for Cyrenaica. "We are assembling a large force to protect the ports. If they are attacked, it will be civil war."

The federalists are confident of success, because the congress itself is under pressure, having drawn protests from across the country for its decision to stay in office beyond its original mandate, which expired last month. Elections are not planned before the summer.

Many in the eastern capital of Benghazi are braced for clashes. "There's tension everywhere on the streets," said one resident, a businessman who asked not to be named. "Everyone is preparing for war. Troops are gathering at the Red Wadi."

Outside analysts say the removal of Zeidan may have cut away the middle ground for a compromise. "You're getting quite close to the point where eastern Libya says this is UDI [unilateral declaration of independence]," said John Hamilton, a London-based oil analyst.

In the east, rebel forces hope to have the support of the air force, three air bases having effectively mutinied and joined with a former general, Khalifa Hiftar, who last month called for congress to be removed by force.

Having shipped their first consignment of oil, the federalists said more was planned. "Another tanker will be loading from the port of Tobruk in the next few days," said El-Megrabi.

The international response has so far been muted. Britain and the US have issued statements opposing federalist attempts to sell oil independently, but diplomats say their political leverage is limited to offering mediation between the factions.

"With control of the central government and Libya's oil at stake, all these groups, rivalries and alliances of convenience are coming to the fore. What happens next will be violent," said Geoff Porter of British security firm North Africa Risk Consulting.