Updated

The United Nations envoy to Libya has urged the country's rival militias to cease fire and work on a political settlement.

Bernardino Leon's visit to the eastern city of Tobruk, the seat of the elected parliament, came at a time Islamist-allied militias have cemented their control over the capital, Tripoli, after defeating rivals in battles that forced thousands to flee.

Leon told reporters on Monday after holding talks with lawmakers that the parliament is the "legitimate representative of the Libyan people." Islamist-allied militias contest this point, having formed their own government and revived an outgoing parliament to take over legislative and executive authorities.

The clashes between militias have been the worst bout of violence Libya ever witnessed since the downfall of dictator Moammar Gadhafi in 2011.